mirror of
https://github.com/actions/setup-java.git
synced 2025-04-20 09:56:46 +00:00
Fix.
This commit is contained in:
parent
596a6da241
commit
c1a589c5b6
7078 changed files with 1882834 additions and 319 deletions
351
node_modules/jsdom/lib/api.js
generated
vendored
Normal file
351
node_modules/jsdom/lib/api.js
generated
vendored
Normal file
|
@ -0,0 +1,351 @@
|
|||
"use strict";
|
||||
const path = require("path");
|
||||
const fs = require("pn/fs");
|
||||
const vm = require("vm");
|
||||
const toughCookie = require("tough-cookie");
|
||||
const request = require("request-promise-native");
|
||||
const sniffHTMLEncoding = require("html-encoding-sniffer");
|
||||
const whatwgURL = require("whatwg-url");
|
||||
const whatwgEncoding = require("whatwg-encoding");
|
||||
const { URL } = require("whatwg-url");
|
||||
const MIMEType = require("whatwg-mimetype");
|
||||
const idlUtils = require("./jsdom/living/generated/utils.js");
|
||||
const VirtualConsole = require("./jsdom/virtual-console.js");
|
||||
const Window = require("./jsdom/browser/Window.js");
|
||||
const { domToHtml } = require("./jsdom/browser/domtohtml.js");
|
||||
const { applyDocumentFeatures } = require("./jsdom/browser/documentfeatures.js");
|
||||
const { wrapCookieJarForRequest } = require("./jsdom/browser/resource-loader.js");
|
||||
const { version: packageVersion } = require("../package.json");
|
||||
|
||||
const DEFAULT_USER_AGENT = `Mozilla/5.0 (${process.platform}) AppleWebKit/537.36 (KHTML, like Gecko) ` +
|
||||
`jsdom/${packageVersion}`;
|
||||
|
||||
// This symbol allows us to smuggle a non-public option through to the JSDOM constructor, for use by JSDOM.fromURL.
|
||||
const transportLayerEncodingLabelHiddenOption = Symbol("transportLayerEncodingLabel");
|
||||
|
||||
class CookieJar extends toughCookie.CookieJar {
|
||||
constructor(store, options) {
|
||||
// jsdom cookie jars must be loose by default
|
||||
super(store, Object.assign({ looseMode: true }, options));
|
||||
}
|
||||
}
|
||||
|
||||
const window = Symbol("window");
|
||||
let sharedFragmentDocument = null;
|
||||
|
||||
class JSDOM {
|
||||
constructor(input, options = {}) {
|
||||
const { html, encoding } = normalizeHTML(input, options[transportLayerEncodingLabelHiddenOption]);
|
||||
options = transformOptions(options, encoding);
|
||||
|
||||
this[window] = new Window(options.windowOptions);
|
||||
|
||||
// TODO NEWAPI: the whole "features" infrastructure is horrible and should be re-built. When we switch to newapi
|
||||
// wholesale, or perhaps before, we should re-do it. For now, just adapt the new, nice, public API into the old,
|
||||
// ugly, internal API.
|
||||
const features = {
|
||||
FetchExternalResources: [],
|
||||
SkipExternalResources: false
|
||||
};
|
||||
|
||||
if (options.resources === "usable") {
|
||||
features.FetchExternalResources = ["link", "img", "frame", "iframe"];
|
||||
if (options.windowOptions.runScripts === "dangerously") {
|
||||
features.FetchExternalResources.push("script");
|
||||
}
|
||||
|
||||
// Note that "img" will be ignored by the code in HTMLImageElement-impl.js if canvas is not installed.
|
||||
// TODO NEWAPI: clean that up and centralize the logic here.
|
||||
}
|
||||
|
||||
const documentImpl = idlUtils.implForWrapper(this[window]._document);
|
||||
applyDocumentFeatures(documentImpl, features);
|
||||
|
||||
options.beforeParse(this[window]._globalProxy);
|
||||
|
||||
// TODO NEWAPI: this is still pretty hacky. It's also different than jsdom.jsdom. Does it work? Can it be better?
|
||||
documentImpl._htmlToDom.appendToDocument(html, documentImpl);
|
||||
documentImpl.close();
|
||||
}
|
||||
|
||||
get window() {
|
||||
// It's important to grab the global proxy, instead of just the result of `new Window(...)`, 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 domToHtml([idlUtils.implForWrapper(this[window]._document)]);
|
||||
}
|
||||
|
||||
nodeLocation(node) {
|
||||
if (!idlUtils.implForWrapper(this[window]._document)._parseOptions.locationInfo) {
|
||||
throw new Error("Location information was not saved for this jsdom. Use includeNodeLocations during creation.");
|
||||
}
|
||||
|
||||
return idlUtils.implForWrapper(node).__location;
|
||||
}
|
||||
|
||||
runVMScript(script) {
|
||||
if (!vm.isContext(this[window])) {
|
||||
throw new TypeError("This jsdom was not configured to allow script running. " +
|
||||
"Use the runScripts option during creation.");
|
||||
}
|
||||
|
||||
return script.runInContext(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);
|
||||
}
|
||||
}
|
||||
|
||||
static fragment(string) {
|
||||
if (!sharedFragmentDocument) {
|
||||
sharedFragmentDocument = (new JSDOM()).window.document;
|
||||
}
|
||||
|
||||
const template = sharedFragmentDocument.createElement("template");
|
||||
template.innerHTML = string;
|
||||
return template.content;
|
||||
}
|
||||
|
||||
static fromURL(url, options = {}) {
|
||||
return Promise.resolve().then(() => {
|
||||
const parsedURL = new URL(url);
|
||||
url = parsedURL.href;
|
||||
options = normalizeFromURLOptions(options);
|
||||
|
||||
const requestOptions = {
|
||||
resolveWithFullResponse: true,
|
||||
encoding: null, // i.e., give me the raw Buffer
|
||||
gzip: true,
|
||||
headers: {
|
||||
"User-Agent": options.userAgent,
|
||||
Referer: options.referrer,
|
||||
Accept: "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
||||
"Accept-Language": "en"
|
||||
},
|
||||
jar: wrapCookieJarForRequest(options.cookieJar)
|
||||
};
|
||||
|
||||
return request(url, requestOptions).then(res => {
|
||||
let transportLayerEncodingLabel;
|
||||
if ("content-type" in res.headers) {
|
||||
const mimeType = new MIMEType(res.headers["content-type"]);
|
||||
transportLayerEncodingLabel = mimeType.parameters.get("charset");
|
||||
}
|
||||
|
||||
options = Object.assign(options, {
|
||||
url: res.request.href + parsedURL.hash,
|
||||
contentType: res.headers["content-type"],
|
||||
referrer: res.request.getHeader("referer"),
|
||||
[transportLayerEncodingLabelHiddenOption]: transportLayerEncodingLabel
|
||||
});
|
||||
|
||||
return new JSDOM(res.body, options);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
static fromFile(filename, options = {}) {
|
||||
return Promise.resolve().then(() => {
|
||||
options = normalizeFromFileOptions(filename, options);
|
||||
|
||||
return fs.readFile(filename).then(buffer => {
|
||||
return new JSDOM(buffer, 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 = Object.assign({}, options);
|
||||
if (options.userAgent === undefined) {
|
||||
normalized.userAgent = DEFAULT_USER_AGENT;
|
||||
}
|
||||
|
||||
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 normalizeFromFileOptions(filename, options) {
|
||||
const normalized = Object.assign({}, options);
|
||||
|
||||
if (normalized.contentType === undefined) {
|
||||
const extname = path.extname(filename);
|
||||
if (extname === ".xhtml" || extname === ".xml") {
|
||||
normalized.contentType = "application/xhtml+xml";
|
||||
}
|
||||
}
|
||||
|
||||
if (normalized.url === undefined) {
|
||||
normalized.url = new URL("file:" + path.resolve(filename));
|
||||
}
|
||||
|
||||
return normalized;
|
||||
}
|
||||
|
||||
function transformOptions(options, encoding) {
|
||||
const transformed = {
|
||||
windowOptions: {
|
||||
// Defaults
|
||||
url: "about:blank",
|
||||
referrer: "",
|
||||
contentType: "text/html",
|
||||
parsingMode: "html",
|
||||
userAgent: DEFAULT_USER_AGENT,
|
||||
parseOptions: { locationInfo: false },
|
||||
runScripts: undefined,
|
||||
encoding,
|
||||
pretendToBeVisual: false,
|
||||
storageQuota: 5000000,
|
||||
|
||||
// Defaults filled in later
|
||||
virtualConsole: undefined,
|
||||
cookieJar: undefined
|
||||
},
|
||||
|
||||
// Defaults
|
||||
resources: undefined,
|
||||
beforeParse() { }
|
||||
};
|
||||
|
||||
if (options.contentType !== undefined) {
|
||||
const mimeType = new MIMEType(options.contentType);
|
||||
|
||||
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.userAgent !== undefined) {
|
||||
transformed.windowOptions.userAgent = String(options.userAgent);
|
||||
}
|
||||
|
||||
if (options.includeNodeLocations) {
|
||||
if (transformed.windowOptions.parsingMode === "xml") {
|
||||
throw new TypeError("Cannot set includeNodeLocations to true with an XML content type");
|
||||
}
|
||||
|
||||
transformed.windowOptions.parseOptions = { locationInfo: true };
|
||||
}
|
||||
|
||||
transformed.windowOptions.cookieJar = options.cookieJar === undefined ?
|
||||
new CookieJar() :
|
||||
options.cookieJar;
|
||||
|
||||
transformed.windowOptions.virtualConsole = options.virtualConsole === undefined ?
|
||||
(new VirtualConsole()).sendTo(console) :
|
||||
options.virtualConsole;
|
||||
|
||||
if (options.resources !== undefined) {
|
||||
transformed.resources = String(options.resources);
|
||||
if (transformed.resources !== "usable") {
|
||||
throw new RangeError(`resources must be undefined or "usable"`);
|
||||
}
|
||||
}
|
||||
|
||||
if (options.runScripts !== undefined) {
|
||||
transformed.windowOptions.runScripts = String(options.runScripts);
|
||||
if (transformed.windowOptions.runScripts !== "dangerously" &&
|
||||
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);
|
||||
}
|
||||
|
||||
// concurrentNodeIterators??
|
||||
|
||||
return transformed;
|
||||
}
|
||||
|
||||
function normalizeHTML(html = "", transportLayerEncodingLabel) {
|
||||
let encoding = "UTF-8";
|
||||
|
||||
if (ArrayBuffer.isView(html)) {
|
||||
html = Buffer.from(html.buffer, html.byteOffset, html.byteLength);
|
||||
} else if (html instanceof ArrayBuffer) {
|
||||
html = Buffer.from(html);
|
||||
}
|
||||
|
||||
if (Buffer.isBuffer(html)) {
|
||||
encoding = sniffHTMLEncoding(html, { defaultEncoding: "windows-1252", transportLayerEncodingLabel });
|
||||
html = whatwgEncoding.decode(html, encoding);
|
||||
} else {
|
||||
html = String(html);
|
||||
}
|
||||
|
||||
return { html, encoding };
|
||||
}
|
||||
|
||||
exports.JSDOM = JSDOM;
|
||||
|
||||
exports.VirtualConsole = VirtualConsole;
|
||||
exports.CookieJar = CookieJar;
|
||||
|
||||
exports.toughCookie = toughCookie;
|
704
node_modules/jsdom/lib/jsdom/browser/Window.js
generated
vendored
Normal file
704
node_modules/jsdom/lib/jsdom/browser/Window.js
generated
vendored
Normal file
|
@ -0,0 +1,704 @@
|
|||
"use strict";
|
||||
|
||||
const webIDLConversions = require("webidl-conversions");
|
||||
const { CSSStyleDeclaration } = require("cssstyle");
|
||||
const { Performance: RawPerformance } = require("w3c-hr-time");
|
||||
const notImplemented = require("./not-implemented");
|
||||
const VirtualConsole = require("../virtual-console");
|
||||
const { define, mixin } = require("../utils");
|
||||
const EventTarget = require("../living/generated/EventTarget");
|
||||
const namedPropertiesWindow = require("../living/named-properties-window");
|
||||
const cssom = require("cssom");
|
||||
const postMessage = require("../living/post-message");
|
||||
const DOMException = require("domexception");
|
||||
const { btoa, atob } = require("abab");
|
||||
const idlUtils = require("../living/generated/utils");
|
||||
const createXMLHttpRequest = require("../living/xmlhttprequest");
|
||||
const createFileReader = require("../living/generated/FileReader").createInterface;
|
||||
const createWebSocket = require("../living/generated/WebSocket").createInterface;
|
||||
const WebSocketImpl = require("../living/websockets/WebSocket-impl").implementation;
|
||||
const BarProp = require("../living/generated/BarProp");
|
||||
const Document = require("../living/generated/Document");
|
||||
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 Storage = require("../living/generated/Storage");
|
||||
const createAbortController = require("../living/generated/AbortController").createInterface;
|
||||
const createAbortSignal = require("../living/generated/AbortSignal").createInterface;
|
||||
const reportException = require("../living/helpers/runtime-script-errors");
|
||||
const { matchesDontThrow } = require("../living/helpers/selectors");
|
||||
const SessionHistory = require("../living/window/SessionHistory");
|
||||
const { contextifyWindow } = require("./documentfeatures.js");
|
||||
|
||||
const GlobalEventHandlersImpl = require("../living/nodes/GlobalEventHandlers-impl").implementation;
|
||||
const WindowEventHandlersImpl = require("../living/nodes/WindowEventHandlers-impl").implementation;
|
||||
|
||||
// NB: the require() must be after assigning `module.exports` because this require() is circular
|
||||
// TODO: this above note might not even be true anymore... figure out the cycle and document it, or clean up.
|
||||
module.exports = Window;
|
||||
const dom = require("../living");
|
||||
|
||||
const cssSelectorSplitRE = /((?:[^,"']|"[^"]*"|'[^']*')+)/;
|
||||
|
||||
const defaultStyleSheet = cssom.parse(require("./default-stylesheet"));
|
||||
|
||||
dom.Window = Window;
|
||||
|
||||
// NOTE: per https://heycam.github.io/webidl/#Global, all properties on the Window object must be own-properties.
|
||||
// That is why we assign everything inside of the constructor, instead of using a shared prototype.
|
||||
// You can verify this in e.g. Firefox or Internet Explorer, which do a good job with Web IDL compliance.
|
||||
|
||||
function Window(options) {
|
||||
EventTarget.setup(this);
|
||||
|
||||
const rawPerformance = new RawPerformance();
|
||||
const windowInitialized = rawPerformance.now();
|
||||
|
||||
const window = this;
|
||||
|
||||
mixin(window, WindowEventHandlersImpl.prototype);
|
||||
mixin(window, GlobalEventHandlersImpl.prototype);
|
||||
|
||||
this._initGlobalEvents();
|
||||
|
||||
///// INTERFACES FROM THE DOM
|
||||
// TODO: consider a mode of some sort where these are not shared between all DOM instances
|
||||
// It'd be very memory-expensive in most cases, though.
|
||||
for (const name in dom) {
|
||||
Object.defineProperty(window, name, {
|
||||
enumerable: false,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: dom[name]
|
||||
});
|
||||
}
|
||||
|
||||
///// PRIVATE DATA PROPERTIES
|
||||
|
||||
// vm initialization is deferred until script processing is activated
|
||||
this._globalProxy = this;
|
||||
Object.defineProperty(idlUtils.implForWrapper(this), idlUtils.wrapperSymbol, { get: () => this._globalProxy });
|
||||
|
||||
let timers = Object.create(null);
|
||||
let animationFrameCallbacks = Object.create(null);
|
||||
|
||||
// List options explicitly to be clear which are passed through
|
||||
this._document = Document.create([], {
|
||||
options: {
|
||||
parsingMode: options.parsingMode,
|
||||
contentType: options.contentType,
|
||||
encoding: options.encoding,
|
||||
cookieJar: options.cookieJar,
|
||||
url: options.url,
|
||||
lastModified: options.lastModified,
|
||||
referrer: options.referrer,
|
||||
cookie: options.cookie,
|
||||
deferClose: options.deferClose,
|
||||
resourceLoader: options.resourceLoader,
|
||||
concurrentNodeIterators: options.concurrentNodeIterators,
|
||||
pool: options.pool,
|
||||
agent: options.agent,
|
||||
agentClass: options.agentClass,
|
||||
agentOptions: options.agentOptions,
|
||||
strictSSL: options.strictSSL,
|
||||
proxy: options.proxy,
|
||||
parseOptions: options.parseOptions,
|
||||
defaultView: this._globalProxy,
|
||||
global: this
|
||||
}
|
||||
});
|
||||
// https://html.spec.whatwg.org/#session-history
|
||||
this._sessionHistory = new SessionHistory({
|
||||
document: idlUtils.implForWrapper(this._document),
|
||||
url: idlUtils.implForWrapper(this._document)._URL,
|
||||
stateObject: null
|
||||
}, this);
|
||||
|
||||
// TODO NEWAPI can remove this
|
||||
if (options.virtualConsole) {
|
||||
if (options.virtualConsole instanceof VirtualConsole) {
|
||||
this._virtualConsole = options.virtualConsole;
|
||||
} else {
|
||||
throw new TypeError("options.virtualConsole must be a VirtualConsole (from createVirtualConsole)");
|
||||
}
|
||||
} else {
|
||||
this._virtualConsole = new VirtualConsole();
|
||||
}
|
||||
|
||||
this._runScripts = options.runScripts;
|
||||
if (this._runScripts === "outside-only" || this._runScripts === "dangerously") {
|
||||
contextifyWindow(this);
|
||||
}
|
||||
|
||||
// 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.
|
||||
this._parent = this._top = this._globalProxy;
|
||||
this._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.
|
||||
this._length = 0;
|
||||
|
||||
this._pretendToBeVisual = options.pretendToBeVisual;
|
||||
this._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[this._document.origin]) {
|
||||
this._commonForOrigin = options.commonForOrigin;
|
||||
} else {
|
||||
this._commonForOrigin = {
|
||||
[this._document.origin]: {
|
||||
localStorageArea: new Map(),
|
||||
sessionStorageArea: new Map(),
|
||||
windowsInSameOrigin: [this]
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
this._currentOriginData = this._commonForOrigin[this._document.origin];
|
||||
|
||||
///// WEB STORAGE
|
||||
|
||||
this._localStorage = Storage.create([], {
|
||||
associatedWindow: this,
|
||||
storageArea: this._currentOriginData.localStorageArea,
|
||||
type: "localStorage",
|
||||
url: this._document.documentURI,
|
||||
storageQuota: this._storageQuota
|
||||
});
|
||||
this._sessionStorage = Storage.create([], {
|
||||
associatedWindow: this,
|
||||
storageArea: this._currentOriginData.sessionStorageArea,
|
||||
type: "sessionStorage",
|
||||
url: this._document.documentURI,
|
||||
storageQuota: this._storageQuota
|
||||
});
|
||||
|
||||
///// GETTERS
|
||||
|
||||
const locationbar = BarProp.create();
|
||||
const menubar = BarProp.create();
|
||||
const personalbar = BarProp.create();
|
||||
const scrollbars = BarProp.create();
|
||||
const statusbar = BarProp.create();
|
||||
const toolbar = BarProp.create();
|
||||
const external = External.create();
|
||||
const navigator = Navigator.create([], { userAgent: options.userAgent });
|
||||
const performance = Performance.create([], { rawPerformance });
|
||||
const screen = Screen.create();
|
||||
|
||||
define(this, {
|
||||
get length() {
|
||||
return window._length;
|
||||
},
|
||||
get window() {
|
||||
return window._globalProxy;
|
||||
},
|
||||
get frameElement() {
|
||||
return 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);
|
||||
},
|
||||
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 performance;
|
||||
},
|
||||
get screen() {
|
||||
return screen;
|
||||
},
|
||||
get localStorage() {
|
||||
if (this._document.origin === "null") {
|
||||
throw new DOMException("localStorage is not available for opaque origins", "SecurityError");
|
||||
}
|
||||
|
||||
return this._localStorage;
|
||||
},
|
||||
get sessionStorage() {
|
||||
if (this._document.origin === "null") {
|
||||
throw new DOMException("sessionStorage is not available for opaque origins", "SecurityError");
|
||||
}
|
||||
|
||||
return this._sessionStorage;
|
||||
}
|
||||
});
|
||||
|
||||
namedPropertiesWindow.initializeWindow(this, this._globalProxy);
|
||||
|
||||
///// METHODS for [ImplicitThis] hack
|
||||
// See https://lists.w3.org/Archives/Public/public-script-coord/2015JanMar/0109.html
|
||||
this.addEventListener = this.addEventListener.bind(this);
|
||||
this.removeEventListener = this.removeEventListener.bind(this);
|
||||
this.dispatchEvent = this.dispatchEvent.bind(this);
|
||||
|
||||
///// METHODS
|
||||
|
||||
let latestTimerId = 0;
|
||||
let latestAnimationFrameCallbackId = 0;
|
||||
|
||||
this.setTimeout = function (fn, ms) {
|
||||
const args = [];
|
||||
for (let i = 2; i < arguments.length; ++i) {
|
||||
args[i - 2] = arguments[i];
|
||||
}
|
||||
return startTimer(window, setTimeout, clearTimeout, ++latestTimerId, fn, ms, timers, args);
|
||||
};
|
||||
this.setInterval = function (fn, ms) {
|
||||
const args = [];
|
||||
for (let i = 2; i < arguments.length; ++i) {
|
||||
args[i - 2] = arguments[i];
|
||||
}
|
||||
return startTimer(window, setInterval, clearInterval, ++latestTimerId, fn, ms, timers, args);
|
||||
};
|
||||
this.clearInterval = stopTimer.bind(this, timers);
|
||||
this.clearTimeout = stopTimer.bind(this, timers);
|
||||
|
||||
if (this._pretendToBeVisual) {
|
||||
this.requestAnimationFrame = fn => {
|
||||
const timestamp = rawPerformance.now() - windowInitialized;
|
||||
const fps = 1000 / 60;
|
||||
|
||||
return startTimer(
|
||||
window,
|
||||
setTimeout,
|
||||
clearTimeout,
|
||||
++latestAnimationFrameCallbackId,
|
||||
fn,
|
||||
fps,
|
||||
animationFrameCallbacks,
|
||||
[timestamp]
|
||||
);
|
||||
};
|
||||
this.cancelAnimationFrame = stopTimer.bind(this, animationFrameCallbacks);
|
||||
}
|
||||
|
||||
this.__stopAllTimers = function () {
|
||||
stopAllTimers(timers);
|
||||
stopAllTimers(animationFrameCallbacks);
|
||||
|
||||
latestTimerId = 0;
|
||||
latestAnimationFrameCallbackId = 0;
|
||||
|
||||
timers = Object.create(null);
|
||||
animationFrameCallbacks = Object.create(null);
|
||||
};
|
||||
|
||||
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.setAttribute("value", value);
|
||||
}
|
||||
if (defaultSelected) {
|
||||
impl.setAttribute("selected", "");
|
||||
}
|
||||
impl._selectedness = selected;
|
||||
|
||||
return option;
|
||||
}
|
||||
Object.defineProperty(Option, "prototype", {
|
||||
value: this.HTMLOptionElement.prototype,
|
||||
configurable: false,
|
||||
enumerable: false,
|
||||
writable: false
|
||||
});
|
||||
Object.defineProperty(window, "Option", {
|
||||
value: Option,
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
writable: true
|
||||
});
|
||||
|
||||
function Image() {
|
||||
const img = window._document.createElement("img");
|
||||
const impl = idlUtils.implForWrapper(img);
|
||||
|
||||
if (arguments.length > 0) {
|
||||
impl.setAttribute("width", String(arguments[0]));
|
||||
}
|
||||
if (arguments.length > 1) {
|
||||
impl.setAttribute("height", String(arguments[1]));
|
||||
}
|
||||
|
||||
return img;
|
||||
}
|
||||
Object.defineProperty(Image, "prototype", {
|
||||
value: this.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.setAttribute("preload", "auto");
|
||||
|
||||
if (src !== undefined) {
|
||||
impl.setAttribute("src", String(src));
|
||||
}
|
||||
|
||||
return audio;
|
||||
}
|
||||
Object.defineProperty(Audio, "prototype", {
|
||||
value: this.HTMLAudioElement.prototype,
|
||||
configurable: false,
|
||||
enumerable: false,
|
||||
writable: false
|
||||
});
|
||||
Object.defineProperty(window, "Audio", {
|
||||
value: Audio,
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
writable: true
|
||||
});
|
||||
|
||||
function wrapConsoleMethod(method) {
|
||||
return (...args) => {
|
||||
window._virtualConsole.emit(method, ...args);
|
||||
};
|
||||
}
|
||||
|
||||
this.postMessage = postMessage;
|
||||
|
||||
this.atob = function (str) {
|
||||
const result = atob(str);
|
||||
if (result === null) {
|
||||
throw new DOMException("The string to be decoded contains invalid characters.", "InvalidCharacterError");
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
this.btoa = function (str) {
|
||||
const result = btoa(str);
|
||||
if (result === null) {
|
||||
throw new DOMException("The string to be encoded contains invalid characters.", "InvalidCharacterError");
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
this.FileReader = createFileReader({
|
||||
window: this
|
||||
}).interface;
|
||||
this.WebSocket = createWebSocket({
|
||||
window: this
|
||||
}).interface;
|
||||
|
||||
const AbortSignalWrapper = createAbortSignal({
|
||||
window: this
|
||||
});
|
||||
this.AbortSignal = AbortSignalWrapper.interface;
|
||||
this.AbortController = createAbortController({
|
||||
AbortSignal: AbortSignalWrapper
|
||||
}).interface;
|
||||
|
||||
this.XMLHttpRequest = createXMLHttpRequest(this);
|
||||
|
||||
// TODO: necessary for Blob and FileReader due to different-globals weirdness; investigate how to avoid this.
|
||||
this.ArrayBuffer = ArrayBuffer;
|
||||
this.Int8Array = Int8Array;
|
||||
this.Uint8Array = Uint8Array;
|
||||
this.Uint8ClampedArray = Uint8ClampedArray;
|
||||
this.Int16Array = Int16Array;
|
||||
this.Uint16Array = Uint16Array;
|
||||
this.Int32Array = Int32Array;
|
||||
this.Uint32Array = Uint32Array;
|
||||
this.Float32Array = Float32Array;
|
||||
this.Float64Array = Float64Array;
|
||||
|
||||
this.stop = function () {
|
||||
const manager = idlUtils.implForWrapper(this._document)._requestManager;
|
||||
if (manager) {
|
||||
manager.close();
|
||||
}
|
||||
};
|
||||
|
||||
this.close = function () {
|
||||
// Recursively close child frame windows, then ourselves.
|
||||
const currentWindow = this;
|
||||
(function windowCleaner(windowToClean) {
|
||||
for (let i = 0; i < windowToClean.length; i++) {
|
||||
windowCleaner(windowToClean[i]);
|
||||
}
|
||||
|
||||
// We"re already in our own window.close().
|
||||
if (windowToClean !== currentWindow) {
|
||||
windowToClean.close();
|
||||
}
|
||||
}(this));
|
||||
|
||||
// Clear out all listeners. Any in-flight or upcoming events should not get delivered.
|
||||
idlUtils.implForWrapper(this)._eventListeners = Object.create(null);
|
||||
|
||||
if (this._document) {
|
||||
if (this._document.body) {
|
||||
this._document.body.innerHTML = "";
|
||||
}
|
||||
|
||||
if (this._document.close) {
|
||||
// It's especially important to clear out the listeners here because document.close() causes a "load" event to
|
||||
// fire.
|
||||
idlUtils.implForWrapper(this._document)._eventListeners = Object.create(null);
|
||||
this._document.close();
|
||||
}
|
||||
const doc = idlUtils.implForWrapper(this._document);
|
||||
if (doc._requestManager) {
|
||||
doc._requestManager.close();
|
||||
}
|
||||
delete this._document;
|
||||
}
|
||||
|
||||
this.__stopAllTimers();
|
||||
WebSocketImpl.cleanUpWindow(this);
|
||||
};
|
||||
|
||||
this.getComputedStyle = function (node) {
|
||||
const nodeImpl = idlUtils.implForWrapper(node);
|
||||
const s = node.style;
|
||||
const cs = new CSSStyleDeclaration();
|
||||
const { forEach } = Array.prototype;
|
||||
|
||||
function setPropertiesFromRule(rule) {
|
||||
if (!rule.selectorText) {
|
||||
return;
|
||||
}
|
||||
|
||||
const selectors = rule.selectorText.split(cssSelectorSplitRE);
|
||||
let matched = false;
|
||||
for (const selectorText of selectors) {
|
||||
if (selectorText !== "" && selectorText !== "," && !matched && matchesDontThrow(nodeImpl, selectorText)) {
|
||||
matched = true;
|
||||
forEach.call(rule.style, property => {
|
||||
cs.setProperty(property, rule.style.getPropertyValue(property), rule.style.getPropertyPriority(property));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function readStylesFromStyleSheet(sheet) {
|
||||
forEach.call(sheet.cssRules, rule => {
|
||||
if (rule.media) {
|
||||
if (Array.prototype.indexOf.call(rule.media, "screen") !== -1) {
|
||||
forEach.call(rule.cssRules, setPropertiesFromRule);
|
||||
}
|
||||
} else {
|
||||
setPropertiesFromRule(rule);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
readStylesFromStyleSheet(defaultStyleSheet);
|
||||
forEach.call(node.ownerDocument.styleSheets, readStylesFromStyleSheet);
|
||||
|
||||
forEach.call(s, property => {
|
||||
cs.setProperty(property, s.getPropertyValue(property), s.getPropertyPriority(property));
|
||||
});
|
||||
|
||||
return cs;
|
||||
};
|
||||
|
||||
// The captureEvents() and releaseEvents() methods must do nothing
|
||||
this.captureEvents = function () {};
|
||||
|
||||
this.releaseEvents = function () {};
|
||||
|
||||
///// PUBLIC DATA PROPERTIES (TODO: should be getters)
|
||||
|
||||
this.console = {
|
||||
assert: wrapConsoleMethod("assert"),
|
||||
clear: wrapConsoleMethod("clear"),
|
||||
count: wrapConsoleMethod("count"),
|
||||
debug: wrapConsoleMethod("debug"),
|
||||
error: wrapConsoleMethod("error"),
|
||||
group: wrapConsoleMethod("group"),
|
||||
groupCollapsed: wrapConsoleMethod("groupCollapsed"),
|
||||
groupEnd: wrapConsoleMethod("groupEnd"),
|
||||
info: wrapConsoleMethod("info"),
|
||||
log: wrapConsoleMethod("log"),
|
||||
table: wrapConsoleMethod("table"),
|
||||
time: wrapConsoleMethod("time"),
|
||||
timeEnd: wrapConsoleMethod("timeEnd"),
|
||||
trace: wrapConsoleMethod("trace"),
|
||||
warn: wrapConsoleMethod("warn")
|
||||
};
|
||||
|
||||
function notImplementedMethod(name) {
|
||||
return function () {
|
||||
notImplemented(name, window);
|
||||
};
|
||||
}
|
||||
|
||||
define(this, {
|
||||
name: "nodejs",
|
||||
// Node v6 has issues (presumably in the vm module)
|
||||
// which this property exposes through an XHR test
|
||||
// status: "",
|
||||
devicePixelRatio: 1,
|
||||
innerWidth: 1024,
|
||||
innerHeight: 768,
|
||||
outerWidth: 1024,
|
||||
outerHeight: 768,
|
||||
pageXOffset: 0,
|
||||
pageYOffset: 0,
|
||||
screenX: 0,
|
||||
screenY: 0,
|
||||
scrollX: 0,
|
||||
scrollY: 0,
|
||||
|
||||
// Not in spec, but likely to be added eventually:
|
||||
// https://github.com/w3c/csswg-drafts/issues/1091
|
||||
screenLeft: 0,
|
||||
screenTop: 0,
|
||||
|
||||
alert: notImplementedMethod("window.alert"),
|
||||
blur: notImplementedMethod("window.blur"),
|
||||
confirm: notImplementedMethod("window.confirm"),
|
||||
focus: notImplementedMethod("window.focus"),
|
||||
moveBy: notImplementedMethod("window.moveBy"),
|
||||
moveTo: notImplementedMethod("window.moveTo"),
|
||||
open: notImplementedMethod("window.open"),
|
||||
print: notImplementedMethod("window.print"),
|
||||
prompt: notImplementedMethod("window.prompt"),
|
||||
resizeBy: notImplementedMethod("window.resizeBy"),
|
||||
resizeTo: notImplementedMethod("window.resizeTo"),
|
||||
scroll: notImplementedMethod("window.scroll"),
|
||||
scrollBy: notImplementedMethod("window.scrollBy"),
|
||||
scrollTo: notImplementedMethod("window.scrollTo")
|
||||
});
|
||||
|
||||
///// INITIALIZATION
|
||||
|
||||
process.nextTick(() => {
|
||||
if (!window.document) {
|
||||
return; // window might've been closed already
|
||||
}
|
||||
|
||||
if (window.document.readyState === "complete") {
|
||||
const ev = window.document.createEvent("HTMLEvents");
|
||||
ev.initEvent("load", false, false);
|
||||
window.dispatchEvent(ev);
|
||||
} else {
|
||||
window.document.addEventListener("load", () => {
|
||||
const ev = window.document.createEvent("HTMLEvents");
|
||||
ev.initEvent("load", false, false);
|
||||
window.dispatchEvent(ev);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Object.setPrototypeOf(Window, EventTarget.interface);
|
||||
Object.setPrototypeOf(Window.prototype, EventTarget.interface.prototype);
|
||||
Object.defineProperty(Window.prototype, Symbol.toStringTag, {
|
||||
value: "Window",
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
function startTimer(window, startFn, stopFn, timerId, callback, ms, timerStorage, args) {
|
||||
if (!window || !window._document) {
|
||||
return undefined;
|
||||
}
|
||||
if (typeof callback !== "function") {
|
||||
const code = String(callback);
|
||||
callback = window._globalProxy.eval.bind(window, code + `\n//# sourceURL=${window.location.href}`);
|
||||
}
|
||||
|
||||
const oldCallback = callback;
|
||||
callback = () => {
|
||||
try {
|
||||
oldCallback.apply(window._globalProxy, args);
|
||||
} catch (e) {
|
||||
reportException(window, e, window.location.href);
|
||||
}
|
||||
};
|
||||
|
||||
const res = startFn(callback, ms);
|
||||
timerStorage[timerId] = [res, stopFn];
|
||||
return timerId;
|
||||
}
|
||||
|
||||
function stopTimer(timerStorage, id) {
|
||||
const timer = timerStorage[id];
|
||||
if (timer) {
|
||||
// Need to .call() with undefined to ensure the thisArg is not timer itself
|
||||
timer[1].call(undefined, timer[0]);
|
||||
delete timerStorage[id];
|
||||
}
|
||||
}
|
||||
|
||||
function stopAllTimers(timers) {
|
||||
Object.keys(timers).forEach(key => {
|
||||
const timer = timers[key];
|
||||
// Need to .call() with undefined to ensure the thisArg is not timer itself
|
||||
timer[1].call(undefined, timer[0]);
|
||||
});
|
||||
}
|
785
node_modules/jsdom/lib/jsdom/browser/default-stylesheet.js
generated
vendored
Normal file
785
node_modules/jsdom/lib/jsdom/browser/default-stylesheet.js
generated
vendored
Normal file
|
@ -0,0 +1,785 @@
|
|||
// Ideally, we would use
|
||||
// https://html.spec.whatwg.org/multipage/rendering.html#the-css-user-agent-style-sheet-and-presentational-hints
|
||||
// but for now, just use the version from blink. This file is copied from
|
||||
// https://chromium.googlesource.com/chromium/blink/+/96aa3a280ab7d67178c8f122a04949ce5f8579e0/Source/core/css/html.css
|
||||
// (removed a line which had octal literals inside since octal literals are not allowed in template strings)
|
||||
|
||||
// We use a .js file because otherwise we can't browserify this. (brfs is unusable due to lack of ES2015 support)
|
||||
|
||||
module.exports = `
|
||||
/*
|
||||
* The default style sheet used to render HTML.
|
||||
*
|
||||
* Copyright (C) 2000 Lars Knoll (knoll@kde.org)
|
||||
* Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public License
|
||||
* along with this library; see the file COPYING.LIB. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
@namespace "http://www.w3.org/1999/xhtml";
|
||||
|
||||
html {
|
||||
display: block
|
||||
}
|
||||
|
||||
:root {
|
||||
scroll-blocks-on: start-touch wheel-event
|
||||
}
|
||||
|
||||
/* children of the <head> element all have display:none */
|
||||
head {
|
||||
display: none
|
||||
}
|
||||
|
||||
meta {
|
||||
display: none
|
||||
}
|
||||
|
||||
title {
|
||||
display: none
|
||||
}
|
||||
|
||||
link {
|
||||
display: none
|
||||
}
|
||||
|
||||
style {
|
||||
display: none
|
||||
}
|
||||
|
||||
script {
|
||||
display: none
|
||||
}
|
||||
|
||||
/* generic block-level elements */
|
||||
|
||||
body {
|
||||
display: block;
|
||||
margin: 8px
|
||||
}
|
||||
|
||||
p {
|
||||
display: block;
|
||||
-webkit-margin-before: 1__qem;
|
||||
-webkit-margin-after: 1__qem;
|
||||
-webkit-margin-start: 0;
|
||||
-webkit-margin-end: 0;
|
||||
}
|
||||
|
||||
div {
|
||||
display: block
|
||||
}
|
||||
|
||||
layer {
|
||||
display: block
|
||||
}
|
||||
|
||||
article, aside, footer, header, hgroup, main, nav, section {
|
||||
display: block
|
||||
}
|
||||
|
||||
marquee {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
address {
|
||||
display: block
|
||||
}
|
||||
|
||||
blockquote {
|
||||
display: block;
|
||||
-webkit-margin-before: 1__qem;
|
||||
-webkit-margin-after: 1em;
|
||||
-webkit-margin-start: 40px;
|
||||
-webkit-margin-end: 40px;
|
||||
}
|
||||
|
||||
figcaption {
|
||||
display: block
|
||||
}
|
||||
|
||||
figure {
|
||||
display: block;
|
||||
-webkit-margin-before: 1em;
|
||||
-webkit-margin-after: 1em;
|
||||
-webkit-margin-start: 40px;
|
||||
-webkit-margin-end: 40px;
|
||||
}
|
||||
|
||||
q {
|
||||
display: inline
|
||||
}
|
||||
|
||||
/* nwmatcher does not support ::before and ::after, so we can't render q
|
||||
correctly: https://html.spec.whatwg.org/multipage/rendering.html#phrasing-content-3
|
||||
TODO: add q::before and q::after selectors
|
||||
*/
|
||||
|
||||
center {
|
||||
display: block;
|
||||
/* special centering to be able to emulate the html4/netscape behaviour */
|
||||
text-align: -webkit-center
|
||||
}
|
||||
|
||||
hr {
|
||||
display: block;
|
||||
-webkit-margin-before: 0.5em;
|
||||
-webkit-margin-after: 0.5em;
|
||||
-webkit-margin-start: auto;
|
||||
-webkit-margin-end: auto;
|
||||
border-style: inset;
|
||||
border-width: 1px;
|
||||
box-sizing: border-box
|
||||
}
|
||||
|
||||
map {
|
||||
display: inline
|
||||
}
|
||||
|
||||
video {
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
/* heading elements */
|
||||
|
||||
h1 {
|
||||
display: block;
|
||||
font-size: 2em;
|
||||
-webkit-margin-before: 0.67__qem;
|
||||
-webkit-margin-after: 0.67em;
|
||||
-webkit-margin-start: 0;
|
||||
-webkit-margin-end: 0;
|
||||
font-weight: bold
|
||||
}
|
||||
|
||||
article h1,
|
||||
aside h1,
|
||||
nav h1,
|
||||
section h1 {
|
||||
font-size: 1.5em;
|
||||
-webkit-margin-before: 0.83__qem;
|
||||
-webkit-margin-after: 0.83em;
|
||||
}
|
||||
|
||||
article article h1,
|
||||
article aside h1,
|
||||
article nav h1,
|
||||
article section h1,
|
||||
aside article h1,
|
||||
aside aside h1,
|
||||
aside nav h1,
|
||||
aside section h1,
|
||||
nav article h1,
|
||||
nav aside h1,
|
||||
nav nav h1,
|
||||
nav section h1,
|
||||
section article h1,
|
||||
section aside h1,
|
||||
section nav h1,
|
||||
section section h1 {
|
||||
font-size: 1.17em;
|
||||
-webkit-margin-before: 1__qem;
|
||||
-webkit-margin-after: 1em;
|
||||
}
|
||||
|
||||
/* Remaining selectors are deleted because nwmatcher does not support
|
||||
:matches() and expanding the selectors manually would be far too verbose.
|
||||
Also see https://html.spec.whatwg.org/multipage/rendering.html#sections-and-headings
|
||||
TODO: rewrite to use :matches() when nwmatcher supports it.
|
||||
*/
|
||||
|
||||
h2 {
|
||||
display: block;
|
||||
font-size: 1.5em;
|
||||
-webkit-margin-before: 0.83__qem;
|
||||
-webkit-margin-after: 0.83em;
|
||||
-webkit-margin-start: 0;
|
||||
-webkit-margin-end: 0;
|
||||
font-weight: bold
|
||||
}
|
||||
|
||||
h3 {
|
||||
display: block;
|
||||
font-size: 1.17em;
|
||||
-webkit-margin-before: 1__qem;
|
||||
-webkit-margin-after: 1em;
|
||||
-webkit-margin-start: 0;
|
||||
-webkit-margin-end: 0;
|
||||
font-weight: bold
|
||||
}
|
||||
|
||||
h4 {
|
||||
display: block;
|
||||
-webkit-margin-before: 1.33__qem;
|
||||
-webkit-margin-after: 1.33em;
|
||||
-webkit-margin-start: 0;
|
||||
-webkit-margin-end: 0;
|
||||
font-weight: bold
|
||||
}
|
||||
|
||||
h5 {
|
||||
display: block;
|
||||
font-size: .83em;
|
||||
-webkit-margin-before: 1.67__qem;
|
||||
-webkit-margin-after: 1.67em;
|
||||
-webkit-margin-start: 0;
|
||||
-webkit-margin-end: 0;
|
||||
font-weight: bold
|
||||
}
|
||||
|
||||
h6 {
|
||||
display: block;
|
||||
font-size: .67em;
|
||||
-webkit-margin-before: 2.33__qem;
|
||||
-webkit-margin-after: 2.33em;
|
||||
-webkit-margin-start: 0;
|
||||
-webkit-margin-end: 0;
|
||||
font-weight: bold
|
||||
}
|
||||
|
||||
/* tables */
|
||||
|
||||
table {
|
||||
display: table;
|
||||
border-collapse: separate;
|
||||
border-spacing: 2px;
|
||||
border-color: gray
|
||||
}
|
||||
|
||||
thead {
|
||||
display: table-header-group;
|
||||
vertical-align: middle;
|
||||
border-color: inherit
|
||||
}
|
||||
|
||||
tbody {
|
||||
display: table-row-group;
|
||||
vertical-align: middle;
|
||||
border-color: inherit
|
||||
}
|
||||
|
||||
tfoot {
|
||||
display: table-footer-group;
|
||||
vertical-align: middle;
|
||||
border-color: inherit
|
||||
}
|
||||
|
||||
/* for tables without table section elements (can happen with XHTML or dynamically created tables) */
|
||||
table > tr {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
col {
|
||||
display: table-column
|
||||
}
|
||||
|
||||
colgroup {
|
||||
display: table-column-group
|
||||
}
|
||||
|
||||
tr {
|
||||
display: table-row;
|
||||
vertical-align: inherit;
|
||||
border-color: inherit
|
||||
}
|
||||
|
||||
td, th {
|
||||
display: table-cell;
|
||||
vertical-align: inherit
|
||||
}
|
||||
|
||||
th {
|
||||
font-weight: bold
|
||||
}
|
||||
|
||||
caption {
|
||||
display: table-caption;
|
||||
text-align: -webkit-center
|
||||
}
|
||||
|
||||
/* lists */
|
||||
|
||||
ul, menu, dir {
|
||||
display: block;
|
||||
list-style-type: disc;
|
||||
-webkit-margin-before: 1__qem;
|
||||
-webkit-margin-after: 1em;
|
||||
-webkit-margin-start: 0;
|
||||
-webkit-margin-end: 0;
|
||||
-webkit-padding-start: 40px
|
||||
}
|
||||
|
||||
ol {
|
||||
display: block;
|
||||
list-style-type: decimal;
|
||||
-webkit-margin-before: 1__qem;
|
||||
-webkit-margin-after: 1em;
|
||||
-webkit-margin-start: 0;
|
||||
-webkit-margin-end: 0;
|
||||
-webkit-padding-start: 40px
|
||||
}
|
||||
|
||||
li {
|
||||
display: list-item;
|
||||
text-align: -webkit-match-parent;
|
||||
}
|
||||
|
||||
ul ul, ol ul {
|
||||
list-style-type: circle
|
||||
}
|
||||
|
||||
ol ol ul, ol ul ul, ul ol ul, ul ul ul {
|
||||
list-style-type: square
|
||||
}
|
||||
|
||||
dd {
|
||||
display: block;
|
||||
-webkit-margin-start: 40px
|
||||
}
|
||||
|
||||
dl {
|
||||
display: block;
|
||||
-webkit-margin-before: 1__qem;
|
||||
-webkit-margin-after: 1em;
|
||||
-webkit-margin-start: 0;
|
||||
-webkit-margin-end: 0;
|
||||
}
|
||||
|
||||
dt {
|
||||
display: block
|
||||
}
|
||||
|
||||
ol ul, ul ol, ul ul, ol ol {
|
||||
-webkit-margin-before: 0;
|
||||
-webkit-margin-after: 0
|
||||
}
|
||||
|
||||
/* form elements */
|
||||
|
||||
form {
|
||||
display: block;
|
||||
margin-top: 0__qem;
|
||||
}
|
||||
|
||||
label {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
legend {
|
||||
display: block;
|
||||
-webkit-padding-start: 2px;
|
||||
-webkit-padding-end: 2px;
|
||||
border: none
|
||||
}
|
||||
|
||||
fieldset {
|
||||
display: block;
|
||||
-webkit-margin-start: 2px;
|
||||
-webkit-margin-end: 2px;
|
||||
-webkit-padding-before: 0.35em;
|
||||
-webkit-padding-start: 0.75em;
|
||||
-webkit-padding-end: 0.75em;
|
||||
-webkit-padding-after: 0.625em;
|
||||
border: 2px groove ThreeDFace;
|
||||
min-width: -webkit-min-content;
|
||||
}
|
||||
|
||||
button {
|
||||
-webkit-appearance: button;
|
||||
}
|
||||
|
||||
/* Form controls don't go vertical. */
|
||||
input, textarea, select, button, meter, progress {
|
||||
-webkit-writing-mode: horizontal-tb !important;
|
||||
}
|
||||
|
||||
input, textarea, select, button {
|
||||
margin: 0__qem;
|
||||
font: -webkit-small-control;
|
||||
text-rendering: auto; /* FIXME: Remove when tabs work with optimizeLegibility. */
|
||||
color: initial;
|
||||
letter-spacing: normal;
|
||||
word-spacing: normal;
|
||||
line-height: normal;
|
||||
text-transform: none;
|
||||
text-indent: 0;
|
||||
text-shadow: none;
|
||||
display: inline-block;
|
||||
text-align: start;
|
||||
}
|
||||
|
||||
/* TODO: Add " i" to attribute matchers to support case-insensitive matching */
|
||||
input[type="hidden"] {
|
||||
display: none
|
||||
}
|
||||
|
||||
input {
|
||||
-webkit-appearance: textfield;
|
||||
padding: 1px;
|
||||
background-color: white;
|
||||
border: 2px inset;
|
||||
-webkit-rtl-ordering: logical;
|
||||
-webkit-user-select: text;
|
||||
cursor: auto;
|
||||
}
|
||||
|
||||
input[type="search"] {
|
||||
-webkit-appearance: searchfield;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
select {
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
textarea {
|
||||
-webkit-appearance: textarea;
|
||||
background-color: white;
|
||||
border: 1px solid;
|
||||
-webkit-rtl-ordering: logical;
|
||||
-webkit-user-select: text;
|
||||
flex-direction: column;
|
||||
resize: auto;
|
||||
cursor: auto;
|
||||
padding: 2px;
|
||||
white-space: pre-wrap;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
input[type="password"] {
|
||||
-webkit-text-security: disc !important;
|
||||
}
|
||||
|
||||
input[type="hidden"], input[type="image"], input[type="file"] {
|
||||
-webkit-appearance: initial;
|
||||
padding: initial;
|
||||
background-color: initial;
|
||||
border: initial;
|
||||
}
|
||||
|
||||
input[type="file"] {
|
||||
align-items: baseline;
|
||||
color: inherit;
|
||||
text-align: start !important;
|
||||
}
|
||||
|
||||
input[type="radio"], input[type="checkbox"] {
|
||||
margin: 3px 0.5ex;
|
||||
padding: initial;
|
||||
background-color: initial;
|
||||
border: initial;
|
||||
}
|
||||
|
||||
input[type="button"], input[type="submit"], input[type="reset"] {
|
||||
-webkit-appearance: push-button;
|
||||
-webkit-user-select: none;
|
||||
white-space: pre
|
||||
}
|
||||
|
||||
input[type="button"], input[type="submit"], input[type="reset"], button {
|
||||
align-items: flex-start;
|
||||
text-align: center;
|
||||
cursor: default;
|
||||
color: ButtonText;
|
||||
padding: 2px 6px 3px 6px;
|
||||
border: 2px outset ButtonFace;
|
||||
background-color: ButtonFace;
|
||||
box-sizing: border-box
|
||||
}
|
||||
|
||||
input[type="range"] {
|
||||
-webkit-appearance: slider-horizontal;
|
||||
padding: initial;
|
||||
border: initial;
|
||||
margin: 2px;
|
||||
color: #909090;
|
||||
}
|
||||
|
||||
input[type="button"]:disabled, input[type="submit"]:disabled, input[type="reset"]:disabled,
|
||||
button:disabled, select:disabled, optgroup:disabled, option:disabled,
|
||||
select[disabled]>option {
|
||||
color: GrayText
|
||||
}
|
||||
|
||||
input[type="button"]:active, input[type="submit"]:active, input[type="reset"]:active, button:active {
|
||||
border-style: inset
|
||||
}
|
||||
|
||||
input[type="button"]:active:disabled, input[type="submit"]:active:disabled, input[type="reset"]:active:disabled, button:active:disabled {
|
||||
border-style: outset
|
||||
}
|
||||
|
||||
datalist {
|
||||
display: none
|
||||
}
|
||||
|
||||
area {
|
||||
display: inline;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
param {
|
||||
display: none
|
||||
}
|
||||
|
||||
input[type="checkbox"] {
|
||||
-webkit-appearance: checkbox;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
input[type="radio"] {
|
||||
-webkit-appearance: radio;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
input[type="color"] {
|
||||
-webkit-appearance: square-button;
|
||||
width: 44px;
|
||||
height: 23px;
|
||||
background-color: ButtonFace;
|
||||
/* Same as native_theme_base. */
|
||||
border: 1px #a9a9a9 solid;
|
||||
padding: 1px 2px;
|
||||
}
|
||||
|
||||
input[type="color"][list] {
|
||||
-webkit-appearance: menulist;
|
||||
width: 88px;
|
||||
height: 23px
|
||||
}
|
||||
|
||||
select {
|
||||
-webkit-appearance: menulist;
|
||||
box-sizing: border-box;
|
||||
align-items: center;
|
||||
border: 1px solid;
|
||||
white-space: pre;
|
||||
-webkit-rtl-ordering: logical;
|
||||
color: black;
|
||||
background-color: white;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
optgroup {
|
||||
font-weight: bolder;
|
||||
display: block;
|
||||
}
|
||||
|
||||
option {
|
||||
font-weight: normal;
|
||||
display: block;
|
||||
padding: 0 2px 1px 2px;
|
||||
white-space: pre;
|
||||
min-height: 1.2em;
|
||||
}
|
||||
|
||||
output {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
/* meter */
|
||||
|
||||
meter {
|
||||
-webkit-appearance: meter;
|
||||
box-sizing: border-box;
|
||||
display: inline-block;
|
||||
height: 1em;
|
||||
width: 5em;
|
||||
vertical-align: -0.2em;
|
||||
}
|
||||
|
||||
/* progress */
|
||||
|
||||
progress {
|
||||
-webkit-appearance: progress-bar;
|
||||
box-sizing: border-box;
|
||||
display: inline-block;
|
||||
height: 1em;
|
||||
width: 10em;
|
||||
vertical-align: -0.2em;
|
||||
}
|
||||
|
||||
/* inline elements */
|
||||
|
||||
u, ins {
|
||||
text-decoration: underline
|
||||
}
|
||||
|
||||
strong, b {
|
||||
font-weight: bold
|
||||
}
|
||||
|
||||
i, cite, em, var, address, dfn {
|
||||
font-style: italic
|
||||
}
|
||||
|
||||
tt, code, kbd, samp {
|
||||
font-family: monospace
|
||||
}
|
||||
|
||||
pre, xmp, plaintext, listing {
|
||||
display: block;
|
||||
font-family: monospace;
|
||||
white-space: pre;
|
||||
margin: 1__qem 0
|
||||
}
|
||||
|
||||
mark {
|
||||
background-color: yellow;
|
||||
color: black
|
||||
}
|
||||
|
||||
big {
|
||||
font-size: larger
|
||||
}
|
||||
|
||||
small {
|
||||
font-size: smaller
|
||||
}
|
||||
|
||||
s, strike, del {
|
||||
text-decoration: line-through
|
||||
}
|
||||
|
||||
sub {
|
||||
vertical-align: sub;
|
||||
font-size: smaller
|
||||
}
|
||||
|
||||
sup {
|
||||
vertical-align: super;
|
||||
font-size: smaller
|
||||
}
|
||||
|
||||
nobr {
|
||||
white-space: nowrap
|
||||
}
|
||||
|
||||
/* states */
|
||||
|
||||
:focus {
|
||||
outline: auto 5px -webkit-focus-ring-color
|
||||
}
|
||||
|
||||
/* Read-only text fields do not show a focus ring but do still receive focus */
|
||||
html:focus, body:focus, input[readonly]:focus {
|
||||
outline: none
|
||||
}
|
||||
|
||||
embed:focus, iframe:focus, object:focus {
|
||||
outline: none
|
||||
}
|
||||
|
||||
input:focus, textarea:focus, select:focus {
|
||||
outline-offset: -2px
|
||||
}
|
||||
|
||||
input[type="button"]:focus,
|
||||
input[type="checkbox"]:focus,
|
||||
input[type="file"]:focus,
|
||||
input[type="hidden"]:focus,
|
||||
input[type="image"]:focus,
|
||||
input[type="radio"]:focus,
|
||||
input[type="reset"]:focus,
|
||||
input[type="search"]:focus,
|
||||
input[type="submit"]:focus {
|
||||
outline-offset: 0
|
||||
}
|
||||
|
||||
/* HTML5 ruby elements */
|
||||
|
||||
ruby, rt {
|
||||
text-indent: 0; /* blocks used for ruby rendering should not trigger this */
|
||||
}
|
||||
|
||||
rt {
|
||||
line-height: normal;
|
||||
-webkit-text-emphasis: none;
|
||||
}
|
||||
|
||||
ruby > rt {
|
||||
display: block;
|
||||
font-size: 50%;
|
||||
text-align: start;
|
||||
}
|
||||
|
||||
ruby > rp {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* other elements */
|
||||
|
||||
noframes {
|
||||
display: none
|
||||
}
|
||||
|
||||
frameset, frame {
|
||||
display: block
|
||||
}
|
||||
|
||||
frameset {
|
||||
border-color: inherit
|
||||
}
|
||||
|
||||
iframe {
|
||||
border: 2px inset
|
||||
}
|
||||
|
||||
details {
|
||||
display: block
|
||||
}
|
||||
|
||||
summary {
|
||||
display: block
|
||||
}
|
||||
|
||||
template {
|
||||
display: none
|
||||
}
|
||||
|
||||
bdi, output {
|
||||
unicode-bidi: -webkit-isolate;
|
||||
}
|
||||
|
||||
bdo {
|
||||
unicode-bidi: bidi-override;
|
||||
}
|
||||
|
||||
textarea[dir=auto] {
|
||||
unicode-bidi: -webkit-plaintext;
|
||||
}
|
||||
|
||||
dialog:not([open]) {
|
||||
display: none
|
||||
}
|
||||
|
||||
dialog {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
width: -webkit-fit-content;
|
||||
height: -webkit-fit-content;
|
||||
margin: auto;
|
||||
border: solid;
|
||||
padding: 1em;
|
||||
background: white;
|
||||
color: black
|
||||
}
|
||||
|
||||
/* noscript is handled internally, as it depends on settings. */
|
||||
|
||||
`;
|
55
node_modules/jsdom/lib/jsdom/browser/documentfeatures.js
generated
vendored
Normal file
55
node_modules/jsdom/lib/jsdom/browser/documentfeatures.js
generated
vendored
Normal file
|
@ -0,0 +1,55 @@
|
|||
"use strict";
|
||||
const vm = require("vm");
|
||||
const idlUtils = require("../living/generated/utils");
|
||||
|
||||
exports.availableDocumentFeatures = [
|
||||
"FetchExternalResources",
|
||||
"SkipExternalResources"
|
||||
];
|
||||
|
||||
exports.defaultDocumentFeatures = {
|
||||
FetchExternalResources: ["script", "link"], // omitted by default: "frame"
|
||||
SkipExternalResources: false
|
||||
};
|
||||
|
||||
exports.applyDocumentFeatures = (documentImpl, features = {}) => {
|
||||
for (let i = 0; i < exports.availableDocumentFeatures.length; ++i) {
|
||||
const featureName = exports.availableDocumentFeatures[i];
|
||||
let featureSource;
|
||||
|
||||
if (features[featureName] !== undefined) {
|
||||
featureSource = features[featureName];
|
||||
// We have to check the lowercase version also because the Document feature
|
||||
// methods convert everything to lowercase.
|
||||
} else if (typeof features[featureName.toLowerCase()] !== "undefined") {
|
||||
featureSource = features[featureName.toLowerCase()];
|
||||
} else if (exports.defaultDocumentFeatures[featureName]) {
|
||||
featureSource = exports.defaultDocumentFeatures[featureName];
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
||||
const implImpl = documentImpl._implementation;
|
||||
implImpl._removeFeature(featureName);
|
||||
|
||||
if (featureSource !== undefined) {
|
||||
if (Array.isArray(featureSource)) {
|
||||
for (let j = 0; j < featureSource.length; ++j) {
|
||||
implImpl._addFeature(featureName, featureSource[j]);
|
||||
}
|
||||
} else {
|
||||
implImpl._addFeature(featureName, featureSource);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
exports.contextifyWindow = window => {
|
||||
if (vm.isContext(window)) {
|
||||
return;
|
||||
}
|
||||
|
||||
vm.createContext(window);
|
||||
const documentImpl = idlUtils.implForWrapper(window._document);
|
||||
documentImpl._defaultView = window._globalProxy = vm.runInContext("this", window);
|
||||
};
|
18
node_modules/jsdom/lib/jsdom/browser/domtohtml.js
generated
vendored
Normal file
18
node_modules/jsdom/lib/jsdom/browser/domtohtml.js
generated
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
"use strict";
|
||||
const parse5 = require("parse5");
|
||||
const treeAdapter = require("./parse5-adapter-serialization");
|
||||
const NODE_TYPE = require("../living/node-type");
|
||||
|
||||
exports.domToHtml = iterable => {
|
||||
let ret = "";
|
||||
for (const node of iterable) {
|
||||
if (node.nodeType === NODE_TYPE.DOCUMENT_NODE) {
|
||||
ret += parse5.serialize(node, { treeAdapter });
|
||||
} else {
|
||||
// TODO: maybe parse5 can give us a hook where it serializes the node itself too:
|
||||
// https://github.com/inikulin/parse5/issues/230
|
||||
ret += parse5.serialize({ childNodesForSerializing: [node] }, { treeAdapter });
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
};
|
271
node_modules/jsdom/lib/jsdom/browser/htmltodom.js
generated
vendored
Normal file
271
node_modules/jsdom/lib/jsdom/browser/htmltodom.js
generated
vendored
Normal file
|
@ -0,0 +1,271 @@
|
|||
"use strict";
|
||||
|
||||
const parse5 = require("parse5");
|
||||
const sax = require("sax");
|
||||
const attributes = require("../living/attributes");
|
||||
const DocumentType = require("../living/generated/DocumentType");
|
||||
const JSDOMParse5Adapter = require("./parse5-adapter-parsing");
|
||||
const { HTML_NS } = require("../living/helpers/namespaces");
|
||||
|
||||
// Horrible monkey-patch to implement https://github.com/inikulin/parse5/issues/237
|
||||
const OpenElementStack = require("parse5/lib/parser/open_element_stack");
|
||||
const originalPop = OpenElementStack.prototype.pop;
|
||||
OpenElementStack.prototype.pop = function (...args) {
|
||||
const before = this.items[this.stackTop];
|
||||
originalPop.apply(this, args);
|
||||
if (before._poppedOffStackOfOpenElements) {
|
||||
before._poppedOffStackOfOpenElements();
|
||||
}
|
||||
};
|
||||
|
||||
const originalPush = OpenElementStack.prototype.push;
|
||||
OpenElementStack.prototype.push = function (...args) {
|
||||
originalPush.apply(this, args);
|
||||
const after = this.items[this.stackTop];
|
||||
if (after._pushedOnStackOfOpenElements) {
|
||||
after._pushedOnStackOfOpenElements();
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = class HTMLToDOM {
|
||||
constructor(parsingMode) {
|
||||
this.parser = parsingMode === "xml" ? sax : parse5;
|
||||
}
|
||||
|
||||
appendToNode(html, node) {
|
||||
html = String(html);
|
||||
|
||||
return this._doParse(html, true, node);
|
||||
}
|
||||
|
||||
appendToDocument(html, documentImpl) {
|
||||
html = String(html);
|
||||
|
||||
return this._doParse(html, false, documentImpl, documentImpl._parseOptions);
|
||||
}
|
||||
|
||||
_doParse(...args) {
|
||||
return this.parser === parse5 ? this._parseWithParse5(...args) : this._parseWithSax(...args);
|
||||
}
|
||||
|
||||
_parseWithParse5(html, isFragment, contextNode, options = {}) {
|
||||
const adapter = new JSDOMParse5Adapter(contextNode._ownerDocument || contextNode);
|
||||
options.treeAdapter = adapter;
|
||||
|
||||
if (isFragment) {
|
||||
const fragment = this.parser.parseFragment(contextNode, html, options);
|
||||
|
||||
if (contextNode._templateContents) {
|
||||
contextNode._templateContents.appendChild(fragment);
|
||||
} else {
|
||||
contextNode.appendChild(fragment);
|
||||
}
|
||||
} else {
|
||||
this.parser.parse(html, options);
|
||||
}
|
||||
|
||||
return contextNode;
|
||||
}
|
||||
|
||||
_parseWithSax(html, isFragment, contextNode) {
|
||||
const SaxParser = this.parser.parser;
|
||||
const parser = new SaxParser(/* strict = */true, { xmlns: true, strictEntities: true });
|
||||
parser.noscript = false;
|
||||
parser.looseCase = "toString";
|
||||
const openStack = [contextNode];
|
||||
parser.ontext = text => {
|
||||
setChildForSax(openStack[openStack.length - 1], {
|
||||
type: "text",
|
||||
data: text
|
||||
});
|
||||
};
|
||||
parser.oncdata = cdata => {
|
||||
setChildForSax(openStack[openStack.length - 1], {
|
||||
type: "cdata",
|
||||
data: cdata
|
||||
});
|
||||
};
|
||||
parser.onopentag = arg => {
|
||||
const attrs = Object.keys(arg.attributes).map(key => {
|
||||
const rawAttribute = arg.attributes[key];
|
||||
|
||||
let { prefix } = rawAttribute;
|
||||
let localName = rawAttribute.local;
|
||||
if (prefix === "xmlns" && localName === "") {
|
||||
// intended weirdness in node-sax, see https://github.com/isaacs/sax-js/issues/165
|
||||
localName = prefix;
|
||||
prefix = null;
|
||||
}
|
||||
|
||||
if (prefix === "") {
|
||||
prefix = null;
|
||||
}
|
||||
|
||||
const namespace = rawAttribute.uri === "" ? null : rawAttribute.uri;
|
||||
|
||||
return { name: rawAttribute.name, value: rawAttribute.value, prefix, localName, namespace };
|
||||
});
|
||||
const tag = {
|
||||
type: "tag",
|
||||
name: arg.local,
|
||||
prefix: arg.prefix,
|
||||
namespace: arg.uri,
|
||||
attributes: attrs
|
||||
};
|
||||
|
||||
if (arg.local === "script" && arg.uri === HTML_NS) {
|
||||
openStack.push(tag);
|
||||
} else {
|
||||
const elem = setChildForSax(openStack[openStack.length - 1], tag);
|
||||
openStack.push(elem);
|
||||
}
|
||||
};
|
||||
parser.onclosetag = () => {
|
||||
const elem = openStack.pop();
|
||||
if (elem.constructor.name === "Object") { // we have an empty script tag
|
||||
setChildForSax(openStack[openStack.length - 1], elem);
|
||||
}
|
||||
};
|
||||
parser.onscript = scriptText => {
|
||||
const tag = openStack.pop();
|
||||
tag.children = [{ type: "text", data: scriptText }];
|
||||
const elem = setChildForSax(openStack[openStack.length - 1], tag);
|
||||
openStack.push(elem);
|
||||
};
|
||||
parser.oncomment = comment => {
|
||||
setChildForSax(openStack[openStack.length - 1], {
|
||||
type: "comment",
|
||||
data: comment
|
||||
});
|
||||
};
|
||||
parser.onprocessinginstruction = pi => {
|
||||
setChildForSax(openStack[openStack.length - 1], {
|
||||
type: "directive",
|
||||
name: "?" + pi.name,
|
||||
data: "?" + pi.name + " " + pi.body + "?"
|
||||
});
|
||||
};
|
||||
parser.ondoctype = dt => {
|
||||
setChildForSax(openStack[openStack.length - 1], {
|
||||
type: "directive",
|
||||
name: "!doctype",
|
||||
data: "!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.onerror = err => {
|
||||
throw err;
|
||||
};
|
||||
parser.write(html).close();
|
||||
}
|
||||
};
|
||||
|
||||
function setChildForSax(parentImpl, node) {
|
||||
const currentDocument = (parentImpl && parentImpl._ownerDocument) || parentImpl;
|
||||
|
||||
let newNode;
|
||||
let isTemplateContents = false;
|
||||
switch (node.type) {
|
||||
case "tag":
|
||||
case "script":
|
||||
case "style":
|
||||
newNode = currentDocument._createElementWithCorrectElementInterface(node.name, node.namespace);
|
||||
newNode._prefix = node.prefix || null;
|
||||
newNode._namespaceURI = node.namespace || null;
|
||||
break;
|
||||
|
||||
case "root":
|
||||
// If we are in <template> then add all children to the parent's _templateContents; skip this virtual root node.
|
||||
if (parentImpl.tagName === "TEMPLATE" && parentImpl._namespaceURI === HTML_NS) {
|
||||
newNode = parentImpl._templateContents;
|
||||
isTemplateContents = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case "text":
|
||||
// HTML entities should already be decoded by the parser, so no need to decode them
|
||||
newNode = currentDocument.createTextNode(node.data);
|
||||
break;
|
||||
|
||||
case "cdata":
|
||||
newNode = currentDocument.createCDATASection(node.data);
|
||||
break;
|
||||
|
||||
case "comment":
|
||||
newNode = currentDocument.createComment(node.data);
|
||||
break;
|
||||
|
||||
case "directive":
|
||||
if (node.name[0] === "?" && node.name.toLowerCase() !== "?xml") {
|
||||
const data = node.data.slice(node.name.length + 1, -1);
|
||||
newNode = currentDocument.createProcessingInstruction(node.name.substring(1), data);
|
||||
} else if (node.name.toLowerCase() === "!doctype") {
|
||||
newNode = parseDocType(currentDocument, "<" + node.data + ">");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (!newNode) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (node.attributes) {
|
||||
for (const a of node.attributes) {
|
||||
attributes.setAttributeValue(newNode, a.localName, a.value, a.prefix, a.namespace);
|
||||
}
|
||||
}
|
||||
|
||||
if (node.children) {
|
||||
for (let c = 0; c < node.children.length; c++) {
|
||||
setChildForSax(newNode, node.children[c]);
|
||||
}
|
||||
}
|
||||
|
||||
if (!isTemplateContents) {
|
||||
if (parentImpl._templateContents) {
|
||||
// Setting innerHTML on a <template>
|
||||
parentImpl._templateContents.appendChild(newNode);
|
||||
} else {
|
||||
parentImpl.appendChild(newNode);
|
||||
}
|
||||
}
|
||||
|
||||
return newNode;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
function parseDocType(doc, html) {
|
||||
if (HTML5_DOCTYPE.test(html)) {
|
||||
return createDocumentTypeInternal(doc, "html", "", "");
|
||||
}
|
||||
|
||||
const publicPieces = PUBLIC_DOCTYPE.exec(html);
|
||||
if (publicPieces) {
|
||||
return createDocumentTypeInternal(doc, publicPieces[1], publicPieces[2], publicPieces[3]);
|
||||
}
|
||||
|
||||
const systemPieces = SYSTEM_DOCTYPE.exec(html);
|
||||
if (systemPieces) {
|
||||
return createDocumentTypeInternal(doc, systemPieces[1], "", systemPieces[2]);
|
||||
}
|
||||
|
||||
// Shouldn't get here (the parser shouldn't let us know about invalid doctypes), but our logic likely isn't
|
||||
// real-world perfect, so let's fallback.
|
||||
return createDocumentTypeInternal(doc, "html", "", "");
|
||||
}
|
||||
|
||||
function createDocumentTypeInternal(ownerDocument, name, publicId, systemId) {
|
||||
return DocumentType.createImpl([], { ownerDocument, name, publicId, systemId });
|
||||
}
|
13
node_modules/jsdom/lib/jsdom/browser/not-implemented.js
generated
vendored
Normal file
13
node_modules/jsdom/lib/jsdom/browser/not-implemented.js
generated
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
"use strict";
|
||||
|
||||
module.exports = function (nameForErrorMessage, window) {
|
||||
if (!window) {
|
||||
// Do nothing for window-less documents.
|
||||
return;
|
||||
}
|
||||
|
||||
const error = new Error(`Not implemented: ${nameForErrorMessage}`);
|
||||
error.type = "not implemented";
|
||||
|
||||
window._virtualConsole.emit("jsdomError", error);
|
||||
};
|
110
node_modules/jsdom/lib/jsdom/browser/parse5-adapter-parsing.js
generated
vendored
Normal file
110
node_modules/jsdom/lib/jsdom/browser/parse5-adapter-parsing.js
generated
vendored
Normal file
|
@ -0,0 +1,110 @@
|
|||
"use strict";
|
||||
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("./parse5-adapter-serialization");
|
||||
|
||||
module.exports = class JSDOMParse5Adapter {
|
||||
constructor(documentImpl) {
|
||||
this._documentImpl = 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() {
|
||||
return DocumentFragment.createImpl([], { ownerDocument: this._documentImpl });
|
||||
}
|
||||
|
||||
createElement(localName, namespace, attrs) {
|
||||
const element = this._documentImpl._createElementWithCorrectElementInterface(localName, namespace);
|
||||
element._namespaceURI = namespace;
|
||||
this.adoptAttributes(element, attrs);
|
||||
|
||||
if ("_parserInserted" in element) {
|
||||
element._parserInserted = true;
|
||||
}
|
||||
|
||||
return element;
|
||||
}
|
||||
|
||||
createCommentNode(data) {
|
||||
return Comment.createImpl([], { data, ownerDocument: this._documentImpl });
|
||||
}
|
||||
|
||||
appendChild(parentNode, newNode) {
|
||||
parentNode.appendChild(newNode);
|
||||
}
|
||||
|
||||
insertBefore(parentNode, newNode, referenceNode) {
|
||||
parentNode.insertBefore(newNode, referenceNode);
|
||||
}
|
||||
|
||||
setTemplateContent(templateElement, contentFragment) {
|
||||
templateElement._templateContents = contentFragment;
|
||||
}
|
||||
|
||||
setDocumentType(document, name, publicId, systemId) {
|
||||
// parse5 sometimes gives us these as null.
|
||||
if (name === null) {
|
||||
name = "";
|
||||
}
|
||||
if (publicId === null) {
|
||||
publicId = "";
|
||||
}
|
||||
if (systemId === null) {
|
||||
systemId = "";
|
||||
}
|
||||
|
||||
const documentType = DocumentType.createImpl([], { name, publicId, systemId, ownerDocument: this._documentImpl });
|
||||
document.appendChild(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 textNode = Text.createImpl([], { data: text, ownerDocument: this._documentImpl });
|
||||
|
||||
parentNode.appendChild(textNode);
|
||||
}
|
||||
}
|
||||
|
||||
insertTextBefore(parentNode, text, referenceNode) {
|
||||
const { previousSibling } = referenceNode;
|
||||
if (previousSibling && previousSibling.nodeType === nodeTypes.TEXT_NODE) {
|
||||
previousSibling.data += text;
|
||||
} else {
|
||||
const textNode = Text.createImpl([], { data: text, ownerDocument: this._documentImpl });
|
||||
|
||||
parentNode.insertBefore(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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Object.assign(module.exports.prototype, serializationAdapter);
|
41
node_modules/jsdom/lib/jsdom/browser/parse5-adapter-serialization.js
generated
vendored
Normal file
41
node_modules/jsdom/lib/jsdom/browser/parse5-adapter-serialization.js
generated
vendored
Normal file
|
@ -0,0 +1,41 @@
|
|||
"use strict";
|
||||
const idlUtils = require("../living/generated/utils");
|
||||
const nodeTypes = require("../living/node-type");
|
||||
const { domSymbolTree } = require("../living/helpers/internal-constants");
|
||||
// Serialization only requires a subset of the tree adapter interface.
|
||||
|
||||
// Tree traversing
|
||||
exports.getFirstChild = node => node.firstChild;
|
||||
|
||||
exports.getChildNodes = node => node.childNodesForSerializing || domSymbolTree.childrenToArray(node);
|
||||
|
||||
exports.getParentNode = node => node.parentNode;
|
||||
|
||||
exports.getAttrList = node => idlUtils.wrapperForImpl(node._attributes);
|
||||
|
||||
// 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;
|
275
node_modules/jsdom/lib/jsdom/browser/resource-loader.js
generated
vendored
Normal file
275
node_modules/jsdom/lib/jsdom/browser/resource-loader.js
generated
vendored
Normal file
|
@ -0,0 +1,275 @@
|
|||
"use strict";
|
||||
|
||||
const MIMEType = require("whatwg-mimetype");
|
||||
const parseDataURL = require("data-urls");
|
||||
const sniffHTMLEncoding = require("html-encoding-sniffer");
|
||||
const whatwgEncoding = require("whatwg-encoding");
|
||||
const fs = require("fs");
|
||||
const request = require("request");
|
||||
const { documentBaseURLSerialized } = require("../living/helpers/document-base-url");
|
||||
const NODE_TYPE = require("../living/node-type");
|
||||
|
||||
/* eslint-disable no-restricted-modules */
|
||||
// TODO: stop using the built-in URL in favor of the spec-compliant whatwg-url package
|
||||
// This legacy usage is in the process of being purged.
|
||||
const URL = require("url");
|
||||
/* eslint-enable no-restricted-modules */
|
||||
|
||||
const IS_BROWSER = Object.prototype.toString.call(process) !== "[object process]";
|
||||
|
||||
function createResourceLoadHandler(element, resourceUrl, document, loadCallback) {
|
||||
if (loadCallback === undefined) {
|
||||
loadCallback = () => {
|
||||
// do nothing
|
||||
};
|
||||
}
|
||||
return (err, data, response) => {
|
||||
const ev = document.createEvent("HTMLEvents");
|
||||
|
||||
if (!err) {
|
||||
try {
|
||||
loadCallback.call(element, data, resourceUrl, response);
|
||||
ev.initEvent("load", false, false);
|
||||
} catch (e) {
|
||||
err = e;
|
||||
}
|
||||
}
|
||||
|
||||
if (err) {
|
||||
if (!err.isAbortError) {
|
||||
ev.initEvent("error", false, false);
|
||||
ev.error = err;
|
||||
element.dispatchEvent(ev);
|
||||
|
||||
const error = new Error(`Could not load ${element.localName}: "${resourceUrl}"`);
|
||||
error.detail = err;
|
||||
error.type = "resource loading";
|
||||
|
||||
document._defaultView._virtualConsole.emit("jsdomError", error);
|
||||
}
|
||||
} else {
|
||||
element.dispatchEvent(ev);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
exports.readFile = function (filePath, { defaultEncoding, detectMetaCharset }, callback) {
|
||||
const readableStream = fs.createReadStream(filePath);
|
||||
|
||||
let data = Buffer.alloc(0);
|
||||
|
||||
readableStream.on("error", callback);
|
||||
|
||||
readableStream.on("data", chunk => {
|
||||
data = Buffer.concat([data, chunk]);
|
||||
});
|
||||
|
||||
readableStream.on("end", () => {
|
||||
// Not passing default encoding means binary
|
||||
if (defaultEncoding) {
|
||||
const encoding = detectMetaCharset ?
|
||||
sniffHTMLEncoding(data, { defaultEncoding }) :
|
||||
whatwgEncoding.getBOMEncoding(data) || defaultEncoding;
|
||||
const decoded = whatwgEncoding.decode(data, encoding);
|
||||
callback(null, decoded, { headers: { "content-type": "text/plain;charset=" + encoding } });
|
||||
} else {
|
||||
callback(null, data);
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
abort() {
|
||||
readableStream.destroy();
|
||||
const error = new Error("request canceled by user");
|
||||
error.isAbortError = true;
|
||||
callback(error);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
function readDataURL(dataURL, { defaultEncoding, detectMetaCharset }, callback) {
|
||||
try {
|
||||
const parsed = parseDataURL(dataURL);
|
||||
// If default encoding does not exist, pass on binary data.
|
||||
if (defaultEncoding) {
|
||||
const sniffOptions = {
|
||||
transportLayerEncodingLabel: parsed.mimeType.parameters.get("charset"),
|
||||
defaultEncoding
|
||||
};
|
||||
|
||||
const encoding = detectMetaCharset ?
|
||||
sniffHTMLEncoding(parsed.body, sniffOptions) :
|
||||
whatwgEncoding.getBOMEncoding(parsed.body) ||
|
||||
whatwgEncoding.labelToName(parsed.mimeType.parameters.get("charset")) ||
|
||||
defaultEncoding;
|
||||
const decoded = whatwgEncoding.decode(parsed.body, encoding);
|
||||
|
||||
parsed.mimeType.parameters.set("charset", encoding);
|
||||
|
||||
callback(null, decoded, { headers: { "content-type": parsed.mimeType.toString() } });
|
||||
} else {
|
||||
callback(null, parsed.body, { headers: { "content-type": parsed.mimeType.toString() } });
|
||||
}
|
||||
} catch (err) {
|
||||
callback(err, null);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// NOTE: request wraps tough-cookie cookie jar
|
||||
// (see: https://github.com/request/request/blob/master/lib/cookies.js).
|
||||
// Therefore, to pass our cookie jar to the request, we need to create
|
||||
// request's wrapper and monkey patch it with our jar.
|
||||
exports.wrapCookieJarForRequest = cookieJar => {
|
||||
const jarWrapper = request.jar();
|
||||
jarWrapper._jar = cookieJar;
|
||||
return jarWrapper;
|
||||
};
|
||||
|
||||
function fetch(urlObj, options, callback) {
|
||||
if (urlObj.protocol === "data:") {
|
||||
return readDataURL(urlObj.href, options, callback);
|
||||
} else if (urlObj.hostname) {
|
||||
return exports.download(urlObj, options, callback);
|
||||
}
|
||||
const filePath = urlObj.pathname
|
||||
.replace(/^file:\/\//, "")
|
||||
.replace(/^\/([a-z]):\//i, "$1:/")
|
||||
.replace(/%20/g, " ");
|
||||
return exports.readFile(filePath, options, callback);
|
||||
}
|
||||
|
||||
exports.enqueue = function (element, resourceUrl, callback) {
|
||||
const document = element.nodeType === NODE_TYPE.DOCUMENT_NODE ? element : element._ownerDocument;
|
||||
|
||||
if (document._queue) {
|
||||
const loadHandler = createResourceLoadHandler(element, resourceUrl || document.URL, document, callback);
|
||||
return document._queue.push(loadHandler);
|
||||
}
|
||||
|
||||
return () => {
|
||||
// do nothing in queue-less documents
|
||||
};
|
||||
};
|
||||
|
||||
exports.download = function (url, options, callback) {
|
||||
const requestOptions = {
|
||||
pool: options.pool,
|
||||
agent: options.agent,
|
||||
agentOptions: options.agentOptions,
|
||||
agentClass: options.agentClass,
|
||||
strictSSL: options.strictSSL,
|
||||
gzip: true,
|
||||
jar: exports.wrapCookieJarForRequest(options.cookieJar),
|
||||
encoding: null,
|
||||
headers: {
|
||||
"User-Agent": options.userAgent,
|
||||
"Accept-Language": "en",
|
||||
Accept: options.accept || "*/*"
|
||||
}
|
||||
};
|
||||
if (options.referrer && !IS_BROWSER) {
|
||||
requestOptions.headers.referer = options.referrer;
|
||||
}
|
||||
if (options.proxy) {
|
||||
requestOptions.proxy = options.proxy;
|
||||
}
|
||||
Object.assign(requestOptions.headers, options.headers);
|
||||
|
||||
const { defaultEncoding, detectMetaCharset } = options;
|
||||
|
||||
const req = request(url, requestOptions, (error, response, bufferData) => {
|
||||
if (!error) {
|
||||
// If default encoding does not exist, pass on binary data.
|
||||
if (defaultEncoding) {
|
||||
const contentType = MIMEType.parse(response.headers["content-type"]) || new MIMEType("text/plain");
|
||||
const sniffOptions = {
|
||||
transportLayerEncodingLabel: contentType.parameters.get("charset"),
|
||||
defaultEncoding
|
||||
};
|
||||
|
||||
const encoding = detectMetaCharset ?
|
||||
sniffHTMLEncoding(bufferData, sniffOptions) :
|
||||
whatwgEncoding.getBOMEncoding(bufferData) ||
|
||||
whatwgEncoding.labelToName(contentType.parameters.get("charset")) ||
|
||||
defaultEncoding;
|
||||
const decoded = whatwgEncoding.decode(bufferData, encoding);
|
||||
|
||||
contentType.parameters.set("charset", encoding);
|
||||
response.headers["content-type"] = contentType.toString();
|
||||
|
||||
callback(null, decoded, response);
|
||||
} else {
|
||||
callback(null, bufferData, response);
|
||||
}
|
||||
} else {
|
||||
callback(error, null, response);
|
||||
}
|
||||
});
|
||||
return {
|
||||
abort() {
|
||||
req.abort();
|
||||
const error = new Error("request canceled by user");
|
||||
error.isAbortError = true;
|
||||
callback(error);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
exports.load = function (element, urlString, options, callback) {
|
||||
const document = element._ownerDocument;
|
||||
const documentImpl = document.implementation;
|
||||
|
||||
if (!documentImpl._hasFeature("FetchExternalResources", element.tagName.toLowerCase())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (documentImpl._hasFeature("SkipExternalResources", urlString)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const urlObj = URL.parse(urlString);
|
||||
const enqueued = exports.enqueue(element, urlString, callback);
|
||||
const customLoader = document._customResourceLoader;
|
||||
const requestManager = document._requestManager;
|
||||
const cookieJar = document._cookieJar;
|
||||
|
||||
options.accept = element._accept;
|
||||
options.cookieJar = cookieJar;
|
||||
options.referrer = document.URL;
|
||||
options.pool = document._pool;
|
||||
options.agentOptions = document._agentOptions;
|
||||
options.strictSSL = document._strictSSL;
|
||||
options.proxy = document._proxy;
|
||||
options.userAgent = document._defaultView.navigator.userAgent;
|
||||
|
||||
let req = null;
|
||||
function wrappedEnqueued() {
|
||||
if (req && requestManager) {
|
||||
requestManager.remove(req);
|
||||
}
|
||||
// do not trigger if the window is closed
|
||||
if (element._ownerDocument && element._ownerDocument.defaultView.document) {
|
||||
enqueued.apply(this, arguments);
|
||||
}
|
||||
}
|
||||
if (typeof customLoader === "function") {
|
||||
req = customLoader(
|
||||
{
|
||||
element,
|
||||
url: urlObj,
|
||||
cookie: cookieJar.getCookieStringSync(urlObj, { http: true }),
|
||||
baseUrl: documentBaseURLSerialized(document),
|
||||
defaultFetch(fetchCallback) {
|
||||
return fetch(urlObj, options, fetchCallback);
|
||||
}
|
||||
},
|
||||
wrappedEnqueued
|
||||
);
|
||||
} else {
|
||||
req = fetch(urlObj, options, wrappedEnqueued);
|
||||
}
|
||||
if (req && requestManager) {
|
||||
requestManager.add(req);
|
||||
}
|
||||
};
|
70
node_modules/jsdom/lib/jsdom/level2/style.js
generated
vendored
Normal file
70
node_modules/jsdom/lib/jsdom/level2/style.js
generated
vendored
Normal file
|
@ -0,0 +1,70 @@
|
|||
"use strict";
|
||||
const cssom = require("cssom");
|
||||
const cssstyle = require("cssstyle");
|
||||
|
||||
// http://dev.w3.org/csswg/cssom/#stylesheetlist
|
||||
// TODO: implement using webidl2js
|
||||
function StyleSheetList() {}
|
||||
|
||||
Object.setPrototypeOf(StyleSheetList.prototype, Array.prototype);
|
||||
|
||||
StyleSheetList.prototype.item = function item(i) {
|
||||
return Object.prototype.hasOwnProperty.call(this, i) ? this[i] : null;
|
||||
};
|
||||
|
||||
exports.StyleSheetList = StyleSheetList;
|
||||
|
||||
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?
|
||||
|
||||
core.StyleSheet = cssom.StyleSheet;
|
||||
core.MediaList = cssom.MediaList;
|
||||
core.CSSStyleSheet = cssom.CSSStyleSheet;
|
||||
core.CSSRule = cssom.CSSRule;
|
||||
core.CSSStyleRule = cssom.CSSStyleRule;
|
||||
core.CSSMediaRule = cssom.CSSMediaRule;
|
||||
core.CSSImportRule = cssom.CSSImportRule;
|
||||
core.CSSStyleDeclaration = cssstyle.CSSStyleDeclaration;
|
||||
core.StyleSheetList = StyleSheetList;
|
||||
|
||||
// Relavant 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
|
||||
};
|
1874
node_modules/jsdom/lib/jsdom/level3/xpath.js
generated
vendored
Normal file
1874
node_modules/jsdom/lib/jsdom/level3/xpath.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
15
node_modules/jsdom/lib/jsdom/living/aborting/AbortController-impl.js
generated
vendored
Normal file
15
node_modules/jsdom/lib/jsdom/living/aborting/AbortController-impl.js
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
"use strict";
|
||||
|
||||
class AbortControllerImpl {
|
||||
constructor(args, privateData) {
|
||||
this.signal = privateData.AbortSignal.createImpl([]);
|
||||
}
|
||||
|
||||
abort() {
|
||||
this.signal._signalAbort();
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
implementation: AbortControllerImpl
|
||||
};
|
55
node_modules/jsdom/lib/jsdom/living/aborting/AbortSignal-impl.js
generated
vendored
Normal file
55
node_modules/jsdom/lib/jsdom/living/aborting/AbortSignal-impl.js
generated
vendored
Normal file
|
@ -0,0 +1,55 @@
|
|||
"use strict";
|
||||
|
||||
const { setupForSimpleEventAccessors } = require("../helpers/create-event-accessor");
|
||||
const EventTargetImpl = require("../events/EventTarget-impl").implementation;
|
||||
|
||||
const Event = require("../generated/Event");
|
||||
|
||||
class AbortSignalImpl extends EventTargetImpl {
|
||||
constructor(args, privateData) {
|
||||
super();
|
||||
|
||||
// make event firing possible
|
||||
this._ownerDocument = privateData.window.document;
|
||||
|
||||
this.aborted = false;
|
||||
this.abortAlgorithms = new Set();
|
||||
}
|
||||
|
||||
_signalAbort() {
|
||||
if (this.aborted) {
|
||||
return;
|
||||
}
|
||||
this.aborted = true;
|
||||
|
||||
for (const algorithm of this.abortAlgorithms) {
|
||||
algorithm();
|
||||
}
|
||||
this.abortAlgorithms.clear();
|
||||
|
||||
this._dispatch(Event.createImpl(
|
||||
[
|
||||
"abort",
|
||||
{ bubbles: false, cancelable: false }
|
||||
],
|
||||
{ isTrusted: true }
|
||||
));
|
||||
}
|
||||
|
||||
_addAlgorithm(algorithm) {
|
||||
if (this.aborted) {
|
||||
return;
|
||||
}
|
||||
this.abortAlgorithms.add(algorithm);
|
||||
}
|
||||
|
||||
_removeAlgorithm(algorithm) {
|
||||
this.abortAlgorithms.delete(algorithm);
|
||||
}
|
||||
}
|
||||
|
||||
setupForSimpleEventAccessors(AbortSignalImpl.prototype, ["abort"]);
|
||||
|
||||
module.exports = {
|
||||
implementation: AbortSignalImpl
|
||||
};
|
299
node_modules/jsdom/lib/jsdom/living/attributes.js
generated
vendored
Normal file
299
node_modules/jsdom/lib/jsdom/living/attributes.js
generated
vendored
Normal file
|
@ -0,0 +1,299 @@
|
|||
"use strict";
|
||||
const DOMException = require("domexception");
|
||||
const attrGenerated = require("./generated/Attr");
|
||||
const { asciiLowercase } = require("./helpers/strings");
|
||||
const { HTML_NS } = require("./helpers/namespaces");
|
||||
|
||||
// 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.
|
||||
|
||||
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;
|
||||
});
|
||||
};
|
||||
|
||||
exports.changeAttribute = function (element, attribute, value) {
|
||||
// https://dom.spec.whatwg.org/#concept-element-attributes-change
|
||||
|
||||
const oldValue = attribute._value;
|
||||
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, oldValue);
|
||||
};
|
||||
|
||||
exports.appendAttribute = function (element, attribute) {
|
||||
// https://dom.spec.whatwg.org/#concept-element-attributes-append
|
||||
|
||||
const attributeList = element._attributeList;
|
||||
|
||||
// TODO mutation observer stuff
|
||||
|
||||
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, attribute._value, null);
|
||||
};
|
||||
|
||||
exports.removeAttribute = function (element, attribute) {
|
||||
// https://dom.spec.whatwg.org/#concept-element-attributes-remove
|
||||
|
||||
const attributeList = element._attributeList;
|
||||
|
||||
// TODO mutation observer stuff
|
||||
|
||||
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 attributeList = element._attributeList;
|
||||
|
||||
// TODO mutation observer stuff
|
||||
|
||||
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 new DOMException("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 = attrGenerated.createImpl([], { namespace, namespacePrefix: prefix, localName, value });
|
||||
exports.appendAttribute(element, newAttribute);
|
||||
return;
|
||||
}
|
||||
|
||||
exports.changeAttribute(element, attribute, value);
|
||||
};
|
||||
|
||||
exports.setAnExistingAttributeValue = (attribute, value) => {
|
||||
if (attribute._element === null) {
|
||||
attribute._value = value;
|
||||
}
|
||||
|
||||
exports.changeAttribute(attribute._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.copyAttributeList = function (sourceElement, destElement) {
|
||||
// Needed by https://dom.spec.whatwg.org/#concept-node-clone
|
||||
|
||||
for (const sourceAttr of sourceElement._attributeList) {
|
||||
const destAttr = attrGenerated.createImpl([], {
|
||||
namespace: sourceAttr._namespace,
|
||||
namespacePrefix: sourceAttr._namespacePrefix,
|
||||
localName: sourceAttr._localName,
|
||||
value: sourceAttr._value
|
||||
});
|
||||
|
||||
exports.appendAttribute(destElement, destAttr);
|
||||
}
|
||||
};
|
||||
|
||||
exports.attributeListsEqual = function (elementA, elementB) {
|
||||
// Needed by https://dom.spec.whatwg.org/#concept-node-equals
|
||||
|
||||
const listA = elementA._attributeList;
|
||||
const listB = elementB._attributeList;
|
||||
|
||||
if (listA.length !== listB.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (let i = 0; i < listA.length; ++i) {
|
||||
const attrA = listA[i];
|
||||
|
||||
if (!listB.some(attrB => equalsA(attrB))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
function equalsA(attrB) {
|
||||
return attrA._namespace === attrB._namespace && attrA._localName === attrB._localName &&
|
||||
attrA._value === attrB._value;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
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;
|
||||
};
|
75
node_modules/jsdom/lib/jsdom/living/attributes/Attr-impl.js
generated
vendored
Normal file
75
node_modules/jsdom/lib/jsdom/living/attributes/Attr-impl.js
generated
vendored
Normal file
|
@ -0,0 +1,75 @@
|
|||
"use strict";
|
||||
|
||||
const attributes = require("../attributes.js");
|
||||
|
||||
exports.implementation = class AttrImpl {
|
||||
constructor(_, 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.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(v) {
|
||||
if (this._element === null) {
|
||||
this._value = v;
|
||||
} else {
|
||||
attributes.changeAttribute(this._element, this, v);
|
||||
}
|
||||
}
|
||||
|
||||
// Delegate to value
|
||||
get nodeValue() {
|
||||
return this.value;
|
||||
}
|
||||
set nodeValue(v) {
|
||||
this.value = v;
|
||||
}
|
||||
|
||||
// Delegate to value
|
||||
get textContent() {
|
||||
return this.value;
|
||||
}
|
||||
set textContent(v) {
|
||||
this.value = v;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
};
|
68
node_modules/jsdom/lib/jsdom/living/attributes/NamedNodeMap-impl.js
generated
vendored
Normal file
68
node_modules/jsdom/lib/jsdom/living/attributes/NamedNodeMap-impl.js
generated
vendored
Normal file
|
@ -0,0 +1,68 @@
|
|||
"use strict";
|
||||
|
||||
const DOMException = require("domexception");
|
||||
const idlUtils = require("../generated/utils.js");
|
||||
const attributes = require("../attributes.js");
|
||||
const { HTML_NS } = require("../helpers/namespaces");
|
||||
|
||||
exports.implementation = class NamedNodeMapImpl {
|
||||
constructor(args, privateData) {
|
||||
this._element = privateData.element;
|
||||
}
|
||||
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) {
|
||||
return attributes.setAttribute(this._element, attr);
|
||||
}
|
||||
setNamedItemNS(attr) {
|
||||
return attributes.setAttribute(this._element, attr);
|
||||
}
|
||||
removeNamedItem(qualifiedName) {
|
||||
const attr = attributes.removeAttributeByName(this._element, qualifiedName);
|
||||
if (attr === null) {
|
||||
throw new DOMException("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 new DOMException("Tried to remove an attribute that was not present", "NotFoundError");
|
||||
}
|
||||
return attr;
|
||||
}
|
||||
};
|
73
node_modules/jsdom/lib/jsdom/living/constraint-validation/DefaultConstraintValidation-impl.js
generated
vendored
Normal file
73
node_modules/jsdom/lib/jsdom/living/constraint-validation/DefaultConstraintValidation-impl.js
generated
vendored
Normal file
|
@ -0,0 +1,73 @@
|
|||
"use strict";
|
||||
|
||||
const ValidityState = require("../generated/ValidityState");
|
||||
const Event = require("../generated/Event");
|
||||
const { isDisabled } = require("../helpers/form-controls");
|
||||
const { closest } = require("../helpers/traversal");
|
||||
|
||||
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);
|
||||
}
|
||||
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;
|
||||
}
|
||||
this.dispatchEvent(Event.createImpl(["invalid", { 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;
|
||||
}
|
||||
};
|
64
node_modules/jsdom/lib/jsdom/living/constraint-validation/ValidityState-impl.js
generated
vendored
Normal file
64
node_modules/jsdom/lib/jsdom/living/constraint-validation/ValidityState-impl.js
generated
vendored
Normal file
|
@ -0,0 +1,64 @@
|
|||
"use strict";
|
||||
|
||||
exports.implementation = class ValidityStateImpl {
|
||||
constructor(element, state = {}) {
|
||||
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 this._element.willValidate && 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);
|
||||
}
|
||||
};
|
57
node_modules/jsdom/lib/jsdom/living/domparsing/DOMParser-impl.js
generated
vendored
Normal file
57
node_modules/jsdom/lib/jsdom/living/domparsing/DOMParser-impl.js
generated
vendored
Normal file
|
@ -0,0 +1,57 @@
|
|||
"use strict";
|
||||
const Document = require("../generated/Document");
|
||||
const { applyDocumentFeatures } = require("../../browser/documentfeatures");
|
||||
|
||||
exports.implementation = class DOMParserImpl {
|
||||
parseFromString(string, contentType) {
|
||||
switch (String(contentType)) {
|
||||
case "text/html": {
|
||||
return createScriptingDisabledDocument("html", contentType, string);
|
||||
}
|
||||
|
||||
case "text/xml":
|
||||
case "application/xml":
|
||||
case "application/xhtml+xml":
|
||||
case "image/svg+xml": {
|
||||
// TODO: use a strict XML parser (sax's strict mode might work?) and create parsererror elements
|
||||
try {
|
||||
return createScriptingDisabledDocument("xml", contentType, string);
|
||||
} catch (error) {
|
||||
const document = 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");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function createScriptingDisabledDocument(parsingMode, contentType, string) {
|
||||
const document = Document.createImpl([], {
|
||||
options: {
|
||||
parsingMode,
|
||||
encoding: "UTF-8",
|
||||
contentType
|
||||
// TODO: somehow set URL to active document's URL
|
||||
}
|
||||
});
|
||||
|
||||
// "scripting enabled" set to false
|
||||
applyDocumentFeatures(document, {
|
||||
FetchExternalResources: [],
|
||||
SkipExternalResources: false
|
||||
});
|
||||
|
||||
if (string !== undefined) {
|
||||
document._htmlToDom.appendToDocument(string, document);
|
||||
}
|
||||
document.close();
|
||||
return document;
|
||||
}
|
10
node_modules/jsdom/lib/jsdom/living/events/CloseEvent-impl.js
generated
vendored
Normal file
10
node_modules/jsdom/lib/jsdom/living/events/CloseEvent-impl.js
generated
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
"use strict";
|
||||
|
||||
const EventImpl = require("./Event-impl").implementation;
|
||||
|
||||
const CloseEventInit = require("../generated/CloseEventInit");
|
||||
|
||||
class CloseEventImpl extends EventImpl {}
|
||||
CloseEventImpl.defaultInit = CloseEventInit.convert(undefined);
|
||||
|
||||
exports.implementation = CloseEventImpl;
|
20
node_modules/jsdom/lib/jsdom/living/events/CompositionEvent-impl.js
generated
vendored
Normal file
20
node_modules/jsdom/lib/jsdom/living/events/CompositionEvent-impl.js
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
"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);
|
||||
|
||||
module.exports = {
|
||||
implementation: CompositionEventImpl
|
||||
};
|
21
node_modules/jsdom/lib/jsdom/living/events/CustomEvent-impl.js
generated
vendored
Normal file
21
node_modules/jsdom/lib/jsdom/living/events/CustomEvent-impl.js
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
"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);
|
||||
|
||||
module.exports = {
|
||||
implementation: CustomEventImpl
|
||||
};
|
14
node_modules/jsdom/lib/jsdom/living/events/ErrorEvent-impl.js
generated
vendored
Normal file
14
node_modules/jsdom/lib/jsdom/living/events/ErrorEvent-impl.js
generated
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
"use strict";
|
||||
|
||||
const EventImpl = require("./Event-impl").implementation;
|
||||
|
||||
const ErrorEventInit = require("../generated/ErrorEventInit");
|
||||
|
||||
class ErrorEventImpl extends EventImpl {
|
||||
|
||||
}
|
||||
ErrorEventImpl.defaultInit = ErrorEventInit.convert(undefined);
|
||||
|
||||
module.exports = {
|
||||
implementation: ErrorEventImpl
|
||||
};
|
107
node_modules/jsdom/lib/jsdom/living/events/Event-impl.js
generated
vendored
Normal file
107
node_modules/jsdom/lib/jsdom/living/events/Event-impl.js
generated
vendored
Normal file
|
@ -0,0 +1,107 @@
|
|||
"use strict";
|
||||
|
||||
const EventInit = require("../generated/EventInit");
|
||||
|
||||
class EventImpl {
|
||||
constructor(args, privateData) {
|
||||
const [type, eventInitDict = this.constructor.defaultInit] = args;
|
||||
|
||||
this.type = type;
|
||||
|
||||
this.bubbles = false;
|
||||
this.cancelable = false;
|
||||
for (const key in eventInitDict) {
|
||||
if (key in this.constructor.defaultInit) {
|
||||
this[key] = eventInitDict[key];
|
||||
}
|
||||
}
|
||||
for (const key in this.constructor.defaultInit) {
|
||||
if (!(key in this)) {
|
||||
this[key] = this.constructor.defaultInit[key];
|
||||
}
|
||||
}
|
||||
|
||||
this.target = null;
|
||||
this.currentTarget = null;
|
||||
this.eventPhase = 0;
|
||||
|
||||
this._initializedFlag = true;
|
||||
this._stopPropagationFlag = false;
|
||||
this._stopImmediatePropagationFlag = false;
|
||||
this._canceledFlag = false;
|
||||
this._dispatchFlag = false;
|
||||
|
||||
this.isTrusted = privateData.isTrusted || false;
|
||||
this.timeStamp = Date.now();
|
||||
}
|
||||
|
||||
get srcElement() {
|
||||
return this.target;
|
||||
}
|
||||
|
||||
get returnValue() {
|
||||
return !this._canceledFlag;
|
||||
}
|
||||
|
||||
set returnValue(v) {
|
||||
if (this.cancelable && v === false) {
|
||||
this._canceledFlag = true;
|
||||
}
|
||||
}
|
||||
|
||||
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() {
|
||||
if (this.cancelable) {
|
||||
this._canceledFlag = true;
|
||||
}
|
||||
}
|
||||
|
||||
_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);
|
||||
|
||||
module.exports = {
|
||||
implementation: EventImpl
|
||||
};
|
18
node_modules/jsdom/lib/jsdom/living/events/EventModifierMixin-impl.js
generated
vendored
Normal file
18
node_modules/jsdom/lib/jsdom/living/events/EventModifierMixin-impl.js
generated
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
"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) {
|
||||
return Boolean(this[`modifier${keyArg}`]);
|
||||
}
|
||||
}
|
||||
|
||||
exports.implementation = EventModifierMixinImpl;
|
243
node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js
generated
vendored
Normal file
243
node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js
generated
vendored
Normal file
|
@ -0,0 +1,243 @@
|
|||
"use strict";
|
||||
const DOMException = require("domexception");
|
||||
const reportException = require("../helpers/runtime-script-errors");
|
||||
const { domSymbolTree } = require("../helpers/internal-constants");
|
||||
const idlUtils = require("../generated/utils");
|
||||
|
||||
const Event = require("../generated/Event").interface;
|
||||
|
||||
class EventTargetImpl {
|
||||
constructor() {
|
||||
this._eventListeners = Object.create(null);
|
||||
}
|
||||
|
||||
addEventListener(type, callback, options) {
|
||||
// webidl2js currently can't handle neither optional arguments nor callback interfaces
|
||||
if (callback === undefined || callback === null) {
|
||||
callback = null;
|
||||
} else if (typeof callback !== "object" && typeof callback !== "function") {
|
||||
throw new TypeError("Only undefined, null, an object, or a function are allowed for the callback parameter");
|
||||
}
|
||||
|
||||
options = normalizeEventHandlerOptions(options, ["capture", "once"]);
|
||||
|
||||
if (callback === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
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.options.capture === options.capture && listener.callback === callback) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this._eventListeners[type].push({
|
||||
callback,
|
||||
options
|
||||
});
|
||||
}
|
||||
|
||||
removeEventListener(type, callback, options) {
|
||||
if (callback === undefined || callback === null) {
|
||||
callback = null;
|
||||
} else if (typeof callback !== "object" && typeof callback !== "function") {
|
||||
throw new TypeError("Only undefined, null, an object, or a function are allowed for the callback parameter");
|
||||
}
|
||||
|
||||
options = normalizeEventHandlerOptions(options, ["capture"]);
|
||||
|
||||
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 === callback && listener.options.capture === options.capture) {
|
||||
this._eventListeners[type].splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dispatchEvent(eventImpl) {
|
||||
if (eventImpl._dispatchFlag || !eventImpl._initializedFlag) {
|
||||
throw new DOMException("Tried to dispatch an uninitialized event", "InvalidStateError");
|
||||
}
|
||||
if (eventImpl.eventPhase !== Event.NONE) {
|
||||
throw new DOMException("Tried to dispatch a dispatching event", "InvalidStateError");
|
||||
}
|
||||
|
||||
eventImpl.isTrusted = false;
|
||||
|
||||
return this._dispatch(eventImpl);
|
||||
}
|
||||
|
||||
_dispatch(eventImpl, targetOverride) {
|
||||
eventImpl._dispatchFlag = true;
|
||||
eventImpl.target = targetOverride || this;
|
||||
|
||||
const eventPath = [];
|
||||
let { target } = eventImpl;
|
||||
let targetParent = domSymbolTree.parent(target);
|
||||
while (targetParent) {
|
||||
eventPath.push(targetParent);
|
||||
target = targetParent;
|
||||
targetParent = domSymbolTree.parent(targetParent);
|
||||
}
|
||||
if (eventImpl.type !== "load" && target._defaultView) {
|
||||
// https://html.spec.whatwg.org/#events-and-the-window-object
|
||||
eventPath.push(idlUtils.implForWrapper(target._defaultView));
|
||||
}
|
||||
|
||||
eventImpl.eventPhase = Event.CAPTURING_PHASE;
|
||||
for (let i = eventPath.length - 1; i >= 0; --i) {
|
||||
if (eventImpl._stopPropagationFlag) {
|
||||
break;
|
||||
}
|
||||
|
||||
const object = eventPath[i];
|
||||
const objectImpl = idlUtils.implForWrapper(object) || object; // window :(
|
||||
const eventListeners = objectImpl._eventListeners[eventImpl.type];
|
||||
invokeEventListeners(eventListeners, object, eventImpl);
|
||||
}
|
||||
|
||||
eventImpl.eventPhase = Event.AT_TARGET;
|
||||
|
||||
if (!eventImpl._stopPropagationFlag) {
|
||||
if (this._eventListeners[eventImpl.type]) {
|
||||
const eventListeners = this._eventListeners[eventImpl.type];
|
||||
invokeEventListeners(eventListeners, eventImpl.target, eventImpl);
|
||||
}
|
||||
}
|
||||
|
||||
if (eventImpl.bubbles) {
|
||||
eventImpl.eventPhase = Event.BUBBLING_PHASE;
|
||||
for (let i = 0; i < eventPath.length; ++i) {
|
||||
if (eventImpl._stopPropagationFlag) {
|
||||
break;
|
||||
}
|
||||
|
||||
const object = eventPath[i];
|
||||
const objectImpl = idlUtils.implForWrapper(object) || object; // window :(
|
||||
const eventListeners = objectImpl._eventListeners[eventImpl.type];
|
||||
invokeEventListeners(eventListeners, object, eventImpl);
|
||||
}
|
||||
}
|
||||
|
||||
eventImpl._dispatchFlag = false;
|
||||
eventImpl._stopPropagationFlag = false;
|
||||
eventImpl._stopImmediatePropagationFlag = false;
|
||||
eventImpl.eventPhase = Event.NONE;
|
||||
eventImpl.currentTarget = null;
|
||||
return !eventImpl._canceledFlag;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
implementation: EventTargetImpl
|
||||
};
|
||||
|
||||
function invokeEventListeners(listeners, target, eventImpl) {
|
||||
const wrapper = idlUtils.wrapperForImpl(target);
|
||||
const document = target._ownerDocument || (wrapper && (wrapper._document || wrapper._ownerDocument));
|
||||
// Will be falsy for windows that have closed
|
||||
if (!document) {
|
||||
return;
|
||||
}
|
||||
|
||||
// workaround for events emitted on window (window-proxy)
|
||||
// the wrapper is the root window instance, but we only want to expose the vm proxy at all times
|
||||
if (wrapper._document && wrapper.constructor.name === "Window") {
|
||||
target = idlUtils.implForWrapper(wrapper._document)._defaultView;
|
||||
}
|
||||
eventImpl.currentTarget = target;
|
||||
if (!listeners) {
|
||||
return;
|
||||
}
|
||||
|
||||
const handlers = listeners.slice();
|
||||
for (let i = 0; i < handlers.length; ++i) {
|
||||
if (eventImpl._stopImmediatePropagationFlag) {
|
||||
return;
|
||||
}
|
||||
|
||||
const listener = handlers[i];
|
||||
const { capture, once/* , passive */ } = listener.options;
|
||||
|
||||
if (listeners.indexOf(listener) === -1 ||
|
||||
(eventImpl.eventPhase === Event.CAPTURING_PHASE && !capture) ||
|
||||
(eventImpl.eventPhase === Event.BUBBLING_PHASE && capture)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (once) {
|
||||
listeners.splice(listeners.indexOf(listener), 1);
|
||||
}
|
||||
|
||||
try {
|
||||
if (typeof listener.callback === "object") {
|
||||
if (typeof listener.callback.handleEvent === "function") {
|
||||
listener.callback.handleEvent(idlUtils.wrapperForImpl(eventImpl));
|
||||
}
|
||||
} else {
|
||||
listener.callback.call(idlUtils.wrapperForImpl(eventImpl.currentTarget), idlUtils.wrapperForImpl(eventImpl));
|
||||
}
|
||||
} catch (e) {
|
||||
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 XHR and some other non-webidl2js things
|
||||
window = wrapper._ownerDocument._defaultView;
|
||||
}
|
||||
|
||||
if (window) {
|
||||
reportException(window, e);
|
||||
}
|
||||
// Errors in window-less documents just get swallowed... can you think of anything better?
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalize the event listeners options argument in order to get always a valid options object
|
||||
* @param {Object} options - user defined options
|
||||
* @param {Array} defaultBoolKeys - boolean properties that should belong to the options object
|
||||
* @returns {Object} object containing at least the "defaultBoolKeys"
|
||||
*/
|
||||
function normalizeEventHandlerOptions(options, defaultBoolKeys) {
|
||||
const returnValue = {};
|
||||
|
||||
// no need to go further here
|
||||
if (typeof options === "boolean" || options === null || typeof options === "undefined") {
|
||||
returnValue.capture = Boolean(options);
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
// non objects options so we typecast its value as "capture" value
|
||||
if (typeof options !== "object") {
|
||||
returnValue.capture = Boolean(options);
|
||||
// at this point we don't need to loop the "capture" key anymore
|
||||
defaultBoolKeys = defaultBoolKeys.filter(k => k !== "capture");
|
||||
}
|
||||
|
||||
for (const key of defaultBoolKeys) {
|
||||
returnValue[key] = Boolean(options[key]);
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
9
node_modules/jsdom/lib/jsdom/living/events/FocusEvent-impl.js
generated
vendored
Normal file
9
node_modules/jsdom/lib/jsdom/living/events/FocusEvent-impl.js
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
"use strict";
|
||||
const UIEventImpl = require("./UIEvent-impl").implementation;
|
||||
|
||||
const FocusEventInit = require("../generated/FocusEventInit");
|
||||
|
||||
class FocusEventImpl extends UIEventImpl {}
|
||||
FocusEventImpl.defaultInit = FocusEventInit.convert(undefined);
|
||||
|
||||
exports.implementation = FocusEventImpl;
|
14
node_modules/jsdom/lib/jsdom/living/events/HashChangeEvent-impl.js
generated
vendored
Normal file
14
node_modules/jsdom/lib/jsdom/living/events/HashChangeEvent-impl.js
generated
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
"use strict";
|
||||
|
||||
const EventImpl = require("./Event-impl").implementation;
|
||||
|
||||
const HashChangeEventInit = require("../generated/HashChangeEventInit");
|
||||
|
||||
class HashChangeEventImpl extends EventImpl {
|
||||
|
||||
}
|
||||
HashChangeEventImpl.defaultInit = HashChangeEventInit.convert(undefined);
|
||||
|
||||
module.exports = {
|
||||
implementation: HashChangeEventImpl
|
||||
};
|
29
node_modules/jsdom/lib/jsdom/living/events/KeyboardEvent-impl.js
generated
vendored
Normal file
29
node_modules/jsdom/lib/jsdom/living/events/KeyboardEvent-impl.js
generated
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
"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);
|
||||
|
||||
module.exports = {
|
||||
implementation: KeyboardEventImpl
|
||||
};
|
25
node_modules/jsdom/lib/jsdom/living/events/MessageEvent-impl.js
generated
vendored
Normal file
25
node_modules/jsdom/lib/jsdom/living/events/MessageEvent-impl.js
generated
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
"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);
|
||||
|
||||
module.exports = {
|
||||
implementation: MessageEventImpl
|
||||
};
|
36
node_modules/jsdom/lib/jsdom/living/events/MouseEvent-impl.js
generated
vendored
Normal file
36
node_modules/jsdom/lib/jsdom/living/events/MouseEvent-impl.js
generated
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
"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 {
|
||||
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);
|
||||
|
||||
module.exports = {
|
||||
implementation: MouseEventImpl
|
||||
};
|
9
node_modules/jsdom/lib/jsdom/living/events/PopStateEvent-impl.js
generated
vendored
Normal file
9
node_modules/jsdom/lib/jsdom/living/events/PopStateEvent-impl.js
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
"use strict";
|
||||
const EventImpl = require("./Event-impl.js").implementation;
|
||||
|
||||
const PopStateEventInit = require("../generated/PopStateEventInit");
|
||||
|
||||
class PopStateEventImpl extends EventImpl {}
|
||||
PopStateEventImpl.defaultInit = PopStateEventInit.convert(undefined);
|
||||
|
||||
exports.implementation = PopStateEventImpl;
|
14
node_modules/jsdom/lib/jsdom/living/events/ProgressEvent-impl.js
generated
vendored
Normal file
14
node_modules/jsdom/lib/jsdom/living/events/ProgressEvent-impl.js
generated
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
"use strict";
|
||||
|
||||
const EventImpl = require("./Event-impl").implementation;
|
||||
|
||||
const ProgressEventInit = require("../generated/ProgressEventInit");
|
||||
|
||||
class ProgressEventImpl extends EventImpl {
|
||||
|
||||
}
|
||||
ProgressEventImpl.defaultInit = ProgressEventInit.convert(undefined);
|
||||
|
||||
module.exports = {
|
||||
implementation: ProgressEventImpl
|
||||
};
|
26
node_modules/jsdom/lib/jsdom/living/events/StorageEvent-impl.js
generated
vendored
Normal file
26
node_modules/jsdom/lib/jsdom/living/events/StorageEvent-impl.js
generated
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
"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);
|
||||
|
||||
module.exports = {
|
||||
implementation: StorageEventImpl
|
||||
};
|
14
node_modules/jsdom/lib/jsdom/living/events/TouchEvent-impl.js
generated
vendored
Normal file
14
node_modules/jsdom/lib/jsdom/living/events/TouchEvent-impl.js
generated
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
"use strict";
|
||||
|
||||
const UIEventImpl = require("./UIEvent-impl").implementation;
|
||||
|
||||
const TouchEventInit = require("../generated/TouchEventInit");
|
||||
|
||||
class TouchEventImpl extends UIEventImpl {
|
||||
|
||||
}
|
||||
TouchEventImpl.defaultInit = TouchEventInit.convert(undefined);
|
||||
|
||||
module.exports = {
|
||||
implementation: TouchEventImpl
|
||||
};
|
59
node_modules/jsdom/lib/jsdom/living/events/UIEvent-impl.js
generated
vendored
Normal file
59
node_modules/jsdom/lib/jsdom/living/events/UIEvent-impl.js
generated
vendored
Normal file
|
@ -0,0 +1,59 @@
|
|||
"use strict";
|
||||
|
||||
const idlUtils = require("../generated/utils");
|
||||
const UIEventInit = require("../generated/UIEventInit");
|
||||
const EventImpl = require("./Event-impl").implementation;
|
||||
|
||||
// Until webidl2js gains support for checking for Window, this would have to do.
|
||||
function isWindow(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 isWindow(idlUtils.implForWrapper(val));
|
||||
}
|
||||
|
||||
class UIEventImpl extends EventImpl {
|
||||
constructor(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(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);
|
||||
|
||||
module.exports = {
|
||||
implementation: UIEventImpl
|
||||
};
|
12
node_modules/jsdom/lib/jsdom/living/events/WheelEvent-impl.js
generated
vendored
Normal file
12
node_modules/jsdom/lib/jsdom/living/events/WheelEvent-impl.js
generated
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
"use strict";
|
||||
|
||||
const MouseEventImpl = require("./MouseEvent-impl").implementation;
|
||||
|
||||
const WheelEventInit = require("../generated/WheelEventInit");
|
||||
|
||||
class WheelEventImpl extends MouseEventImpl {}
|
||||
WheelEventImpl.defaultInit = WheelEventInit.convert(undefined);
|
||||
|
||||
module.exports = {
|
||||
implementation: WheelEventImpl
|
||||
};
|
92
node_modules/jsdom/lib/jsdom/living/file-api/Blob-impl.js
generated
vendored
Normal file
92
node_modules/jsdom/lib/jsdom/living/file-api/Blob-impl.js
generated
vendored
Normal file
|
@ -0,0 +1,92 @@
|
|||
"use strict";
|
||||
const { EOL } = require("os");
|
||||
const Blob = require("../generated/Blob");
|
||||
|
||||
function convertLineEndingsToNative(s) {
|
||||
return s.replace(/\r\n|\r|\n/g, EOL);
|
||||
}
|
||||
|
||||
exports.implementation = class BlobImpl {
|
||||
constructor(args) {
|
||||
const parts = args[0];
|
||||
const properties = args[1];
|
||||
|
||||
const buffers = [];
|
||||
|
||||
if (parts !== undefined) {
|
||||
for (const part of parts) {
|
||||
let buffer;
|
||||
if (part instanceof ArrayBuffer) {
|
||||
buffer = Buffer.from(part);
|
||||
} else if (ArrayBuffer.isView(part)) {
|
||||
buffer = Buffer.from(part.buffer, part.byteOffset, part.byteLength);
|
||||
} else if (Blob.isImpl(part)) {
|
||||
buffer = part._buffer;
|
||||
} else {
|
||||
let s = part;
|
||||
if (properties.endings === "native") {
|
||||
s = convertLineEndingsToNative(part);
|
||||
}
|
||||
buffer = Buffer.from(s);
|
||||
}
|
||||
buffers.push(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
this._buffer = Buffer.concat(buffers);
|
||||
|
||||
this.type = properties.type;
|
||||
if (/[^\u0020-\u007E]/.test(this.type)) {
|
||||
this.type = "";
|
||||
} else {
|
||||
this.type = this.type.toLowerCase();
|
||||
}
|
||||
}
|
||||
|
||||
get size() {
|
||||
return this._buffer.length;
|
||||
}
|
||||
|
||||
slice(start, end, contentType) {
|
||||
const { size } = this;
|
||||
|
||||
let relativeStart;
|
||||
let relativeEnd;
|
||||
let 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 buffer = this._buffer;
|
||||
const slicedBuffer = buffer.slice(
|
||||
relativeStart,
|
||||
relativeStart + span
|
||||
);
|
||||
|
||||
const blob = Blob.createImpl([[], { type: relativeContentType }], {});
|
||||
blob._buffer = slicedBuffer;
|
||||
return blob;
|
||||
}
|
||||
};
|
15
node_modules/jsdom/lib/jsdom/living/file-api/File-impl.js
generated
vendored
Normal file
15
node_modules/jsdom/lib/jsdom/living/file-api/File-impl.js
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
"use strict";
|
||||
|
||||
const BlobImpl = require("./Blob-impl").implementation;
|
||||
|
||||
exports.implementation = class FileImpl extends BlobImpl {
|
||||
constructor(args, privateData) {
|
||||
const fileBits = args[0];
|
||||
const fileName = args[1];
|
||||
const options = args[2];
|
||||
super([fileBits, options], privateData);
|
||||
|
||||
this.name = fileName.replace(/\//g, ":");
|
||||
this.lastModified = "lastModified" in options ? options.lastModified : Date.now();
|
||||
}
|
||||
};
|
15
node_modules/jsdom/lib/jsdom/living/file-api/FileList-impl.js
generated
vendored
Normal file
15
node_modules/jsdom/lib/jsdom/living/file-api/FileList-impl.js
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
"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();
|
||||
}
|
||||
};
|
143
node_modules/jsdom/lib/jsdom/living/file-api/FileReader-impl.js
generated
vendored
Normal file
143
node_modules/jsdom/lib/jsdom/living/file-api/FileReader-impl.js
generated
vendored
Normal file
|
@ -0,0 +1,143 @@
|
|||
"use strict";
|
||||
|
||||
const whatwgEncoding = require("whatwg-encoding");
|
||||
const MIMEType = require("whatwg-mimetype");
|
||||
const querystring = require("querystring");
|
||||
const DOMException = require("domexception");
|
||||
const EventTargetImpl = require("../events/EventTarget-impl").implementation;
|
||||
const ProgressEvent = require("../generated/ProgressEvent");
|
||||
const { setupForSimpleEventAccessors } = require("../helpers/create-event-accessor");
|
||||
|
||||
const READY_STATES = Object.freeze({
|
||||
EMPTY: 0,
|
||||
LOADING: 1,
|
||||
DONE: 2
|
||||
});
|
||||
|
||||
const events = ["loadstart", "progress", "load", "abort", "error", "loadend"];
|
||||
|
||||
class FileReaderImpl extends EventTargetImpl {
|
||||
constructor(args, privateData) {
|
||||
super([], privateData);
|
||||
|
||||
this.error = null;
|
||||
this.readyState = READY_STATES.EMPTY;
|
||||
this.result = null;
|
||||
|
||||
this._ownerDocument = privateData.window.document;
|
||||
this._terminated = false;
|
||||
}
|
||||
|
||||
readAsArrayBuffer(file) {
|
||||
this._readFile(file, "buffer");
|
||||
}
|
||||
readAsBinaryString(file) {
|
||||
this._readFile(file, "binaryString");
|
||||
}
|
||||
readAsDataURL(file) {
|
||||
this._readFile(file, "dataURL");
|
||||
}
|
||||
readAsText(file, encoding) {
|
||||
this._readFile(file, "text", whatwgEncoding.labelToName(encoding) || "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) {
|
||||
const event = ProgressEvent.createImpl([name, Object.assign({ bubbles: false, cancelable: false }, props)], {});
|
||||
this.dispatchEvent(event);
|
||||
}
|
||||
|
||||
_readFile(file, format, encoding) {
|
||||
if (this.readyState === READY_STATES.LOADING) {
|
||||
throw new DOMException("The object is in an invalid state.", "InvalidStateError");
|
||||
}
|
||||
|
||||
this.readyState = READY_STATES.LOADING;
|
||||
|
||||
setImmediate(() => {
|
||||
if (this._terminated) {
|
||||
this._terminated = false;
|
||||
return;
|
||||
}
|
||||
|
||||
this._fireProgressEvent("loadstart");
|
||||
|
||||
let data = file._buffer;
|
||||
if (!data) {
|
||||
data = Buffer.alloc(0);
|
||||
}
|
||||
this._fireProgressEvent("progress", {
|
||||
lengthComputable: !isNaN(file.size),
|
||||
total: file.size,
|
||||
loaded: data.length
|
||||
});
|
||||
|
||||
setImmediate(() => {
|
||||
if (this._terminated) {
|
||||
this._terminated = false;
|
||||
return;
|
||||
}
|
||||
|
||||
switch (format) {
|
||||
default:
|
||||
case "buffer": {
|
||||
this.result = (new Uint8Array(data)).buffer;
|
||||
break;
|
||||
}
|
||||
case "binaryString": {
|
||||
this.result = data.toString("binary");
|
||||
break;
|
||||
}
|
||||
case "dataURL": {
|
||||
// Spec seems very unclear here; see https://github.com/whatwg/fetch/issues/665#issuecomment-362930079.
|
||||
let dataUrl = "data:";
|
||||
const contentType = MIMEType.parse(file.type);
|
||||
if (contentType && contentType.type === "text") {
|
||||
const fallbackEncoding = whatwgEncoding.getBOMEncoding(data) ||
|
||||
whatwgEncoding.labelToName(contentType.parameters.get("charset")) || "UTF-8";
|
||||
const decoded = whatwgEncoding.decode(data, fallbackEncoding);
|
||||
|
||||
contentType.parameters.set("charset", encoding);
|
||||
dataUrl += contentType.toString();
|
||||
dataUrl += ",";
|
||||
dataUrl += querystring.escape(decoded);
|
||||
} else {
|
||||
if (contentType) {
|
||||
dataUrl += contentType.toString();
|
||||
}
|
||||
dataUrl += ";base64,";
|
||||
dataUrl += data.toString("base64");
|
||||
}
|
||||
this.result = dataUrl;
|
||||
break;
|
||||
}
|
||||
case "text": {
|
||||
this.result = whatwgEncoding.decode(data, encoding);
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.readyState = READY_STATES.DONE;
|
||||
this._fireProgressEvent("load");
|
||||
this._fireProgressEvent("loadend");
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
setupForSimpleEventAccessors(FileReaderImpl.prototype, events);
|
||||
|
||||
exports.implementation = FileReaderImpl;
|
144
node_modules/jsdom/lib/jsdom/living/generated/AbortController.js
generated
vendored
Normal file
144
node_modules/jsdom/lib/jsdom/living/generated/AbortController.js
generated
vendored
Normal file
|
@ -0,0 +1,144 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const impl = utils.implSymbol;
|
||||
|
||||
module.exports = {
|
||||
createInterface: function(defaultPrivateData = {}) {
|
||||
function AbortController() {
|
||||
if (new.target === undefined) {
|
||||
throw new TypeError(
|
||||
"Failed to construct 'AbortController'. Please use the 'new' operator; this constructor " +
|
||||
"cannot be called as a function."
|
||||
);
|
||||
}
|
||||
|
||||
iface.setup(this);
|
||||
}
|
||||
|
||||
Object.defineProperty(AbortController, "prototype", {
|
||||
value: AbortController.prototype,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: false
|
||||
});
|
||||
|
||||
AbortController.prototype.abort = function abort() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl].abort();
|
||||
};
|
||||
|
||||
Object.defineProperty(AbortController.prototype, "signal", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return utils.getSameObject(this, "signal", () => {
|
||||
return utils.tryWrapperForImpl(this[impl]["signal"]);
|
||||
});
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(AbortController.prototype, Symbol.toStringTag, {
|
||||
value: "AbortController",
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
const iface = {
|
||||
create(constructorArgs, privateData) {
|
||||
let obj = Object.create(AbortController.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return obj;
|
||||
},
|
||||
createImpl(constructorArgs, privateData) {
|
||||
let obj = Object.create(AbortController.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return utils.implForWrapper(obj);
|
||||
},
|
||||
_internalSetup(obj) {},
|
||||
setup(obj, constructorArgs, privateData) {
|
||||
if (!privateData) privateData = {};
|
||||
|
||||
for (var prop in defaultPrivateData) {
|
||||
if (!(prop in privateData)) {
|
||||
privateData[prop] = defaultPrivateData[prop];
|
||||
}
|
||||
}
|
||||
|
||||
privateData.wrapper = obj;
|
||||
|
||||
this._internalSetup(obj);
|
||||
Object.defineProperty(obj, impl, {
|
||||
value: new Impl.implementation(constructorArgs, privateData),
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
obj[impl][utils.wrapperSymbol] = obj;
|
||||
if (Impl.init) {
|
||||
Impl.init(obj[impl], privateData);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
interface: AbortController,
|
||||
expose: {
|
||||
Window: { AbortController },
|
||||
Worker: { AbortController }
|
||||
}
|
||||
}; // iface
|
||||
return iface;
|
||||
}, // createInterface
|
||||
|
||||
// When an interface-module that implements this interface as a mixin is loaded, it will append its own `.is()`
|
||||
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
|
||||
// implementing this mixin interface.
|
||||
_mixedIntoPredicates: [],
|
||||
is(obj) {
|
||||
if (obj) {
|
||||
if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(obj)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
isImpl(obj) {
|
||||
if (obj) {
|
||||
if (obj instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const wrapper = utils.wrapperForImpl(obj);
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(wrapper)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (module.exports.is(obj)) {
|
||||
return utils.implForWrapper(obj);
|
||||
}
|
||||
throw new TypeError(`${context} is not of type 'AbortController'.`);
|
||||
}
|
||||
}; // module.exports
|
||||
|
||||
const Impl = require("../aborting/AbortController-impl.js");
|
156
node_modules/jsdom/lib/jsdom/living/generated/AbortSignal.js
generated
vendored
Normal file
156
node_modules/jsdom/lib/jsdom/living/generated/AbortSignal.js
generated
vendored
Normal file
|
@ -0,0 +1,156 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const impl = utils.implSymbol;
|
||||
const EventTarget = require("./EventTarget.js");
|
||||
|
||||
module.exports = {
|
||||
createInterface: function(defaultPrivateData = {}) {
|
||||
function AbortSignal() {
|
||||
throw new TypeError("Illegal constructor");
|
||||
}
|
||||
|
||||
Object.setPrototypeOf(AbortSignal.prototype, EventTarget.interface.prototype);
|
||||
Object.setPrototypeOf(AbortSignal, EventTarget.interface);
|
||||
|
||||
Object.defineProperty(AbortSignal, "prototype", {
|
||||
value: AbortSignal.prototype,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: false
|
||||
});
|
||||
|
||||
Object.defineProperty(AbortSignal.prototype, "aborted", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["aborted"];
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(AbortSignal.prototype, "onabort", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return utils.tryWrapperForImpl(this[impl]["onabort"]);
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = utils.tryImplForWrapper(V);
|
||||
|
||||
this[impl]["onabort"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(AbortSignal.prototype, Symbol.toStringTag, {
|
||||
value: "AbortSignal",
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
const iface = {
|
||||
create(constructorArgs, privateData) {
|
||||
let obj = Object.create(AbortSignal.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return obj;
|
||||
},
|
||||
createImpl(constructorArgs, privateData) {
|
||||
let obj = Object.create(AbortSignal.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return utils.implForWrapper(obj);
|
||||
},
|
||||
_internalSetup(obj) {
|
||||
EventTarget._internalSetup(obj);
|
||||
},
|
||||
setup(obj, constructorArgs, privateData) {
|
||||
if (!privateData) privateData = {};
|
||||
|
||||
for (var prop in defaultPrivateData) {
|
||||
if (!(prop in privateData)) {
|
||||
privateData[prop] = defaultPrivateData[prop];
|
||||
}
|
||||
}
|
||||
|
||||
privateData.wrapper = obj;
|
||||
|
||||
this._internalSetup(obj);
|
||||
Object.defineProperty(obj, impl, {
|
||||
value: new Impl.implementation(constructorArgs, privateData),
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
obj[impl][utils.wrapperSymbol] = obj;
|
||||
if (Impl.init) {
|
||||
Impl.init(obj[impl], privateData);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
interface: AbortSignal,
|
||||
expose: {
|
||||
Window: { AbortSignal },
|
||||
Worker: { AbortSignal }
|
||||
}
|
||||
}; // iface
|
||||
return iface;
|
||||
}, // createInterface
|
||||
|
||||
// When an interface-module that implements this interface as a mixin is loaded, it will append its own `.is()`
|
||||
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
|
||||
// implementing this mixin interface.
|
||||
_mixedIntoPredicates: [],
|
||||
is(obj) {
|
||||
if (obj) {
|
||||
if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(obj)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
isImpl(obj) {
|
||||
if (obj) {
|
||||
if (obj instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const wrapper = utils.wrapperForImpl(obj);
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(wrapper)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (module.exports.is(obj)) {
|
||||
return utils.implForWrapper(obj);
|
||||
}
|
||||
throw new TypeError(`${context} is not of type 'AbortSignal'.`);
|
||||
}
|
||||
}; // module.exports
|
||||
|
||||
const Impl = require("../aborting/AbortSignal-impl.js");
|
34
node_modules/jsdom/lib/jsdom/living/generated/AddEventListenerOptions.js
generated
vendored
Normal file
34
node_modules/jsdom/lib/jsdom/living/generated/AddEventListenerOptions.js
generated
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const EventListenerOptions = require("./EventListenerOptions.js");
|
||||
|
||||
module.exports = {
|
||||
convertInherit(obj, ret, { context = "The provided value" } = {}) {
|
||||
EventListenerOptions.convertInherit(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" });
|
||||
|
||||
ret[key] = value;
|
||||
} else {
|
||||
ret[key] = false;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") {
|
||||
throw new TypeError(`${context} is not an object.`);
|
||||
}
|
||||
|
||||
const ret = Object.create(null);
|
||||
module.exports.convertInherit(obj, ret, { context });
|
||||
return ret;
|
||||
}
|
||||
};
|
269
node_modules/jsdom/lib/jsdom/living/generated/Attr.js
generated
vendored
Normal file
269
node_modules/jsdom/lib/jsdom/living/generated/Attr.js
generated
vendored
Normal file
|
@ -0,0 +1,269 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const impl = utils.implSymbol;
|
||||
|
||||
function Attr() {
|
||||
throw new TypeError("Illegal constructor");
|
||||
}
|
||||
|
||||
Object.defineProperty(Attr, "prototype", {
|
||||
value: Attr.prototype,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: false
|
||||
});
|
||||
|
||||
Object.defineProperty(Attr.prototype, "namespaceURI", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["namespaceURI"];
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(Attr.prototype, "prefix", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["prefix"];
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(Attr.prototype, "localName", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["localName"];
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(Attr.prototype, "name", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["name"];
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(Attr.prototype, "nodeName", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["nodeName"];
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(Attr.prototype, "value", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["value"];
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["DOMString"](V, { context: "Failed to set the 'value' property on 'Attr': The provided value" });
|
||||
|
||||
this[impl]["value"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(Attr.prototype, "nodeValue", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["nodeValue"];
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["DOMString"](V, {
|
||||
context: "Failed to set the 'nodeValue' property on 'Attr': The provided value",
|
||||
treatNullAsEmptyString: true
|
||||
});
|
||||
|
||||
this[impl]["nodeValue"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(Attr.prototype, "textContent", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["textContent"];
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["DOMString"](V, {
|
||||
context: "Failed to set the 'textContent' property on 'Attr': The provided value",
|
||||
treatNullAsEmptyString: true
|
||||
});
|
||||
|
||||
this[impl]["textContent"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(Attr.prototype, "ownerElement", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return utils.tryWrapperForImpl(this[impl]["ownerElement"]);
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(Attr.prototype, "specified", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["specified"];
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(Attr.prototype, Symbol.toStringTag, {
|
||||
value: "Attr",
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
const iface = {
|
||||
// When an interface-module that implements this interface as a mixin is loaded, it will append its own `.is()`
|
||||
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
|
||||
// implementing this mixin interface.
|
||||
_mixedIntoPredicates: [],
|
||||
is(obj) {
|
||||
if (obj) {
|
||||
if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(obj)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
isImpl(obj) {
|
||||
if (obj) {
|
||||
if (obj instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const wrapper = utils.wrapperForImpl(obj);
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(wrapper)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (module.exports.is(obj)) {
|
||||
return utils.implForWrapper(obj);
|
||||
}
|
||||
throw new TypeError(`${context} is not of type 'Attr'.`);
|
||||
},
|
||||
|
||||
create(constructorArgs, privateData) {
|
||||
let obj = Object.create(Attr.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return obj;
|
||||
},
|
||||
createImpl(constructorArgs, privateData) {
|
||||
let obj = Object.create(Attr.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return utils.implForWrapper(obj);
|
||||
},
|
||||
_internalSetup(obj) {},
|
||||
setup(obj, constructorArgs, privateData) {
|
||||
if (!privateData) privateData = {};
|
||||
|
||||
privateData.wrapper = obj;
|
||||
|
||||
this._internalSetup(obj);
|
||||
Object.defineProperty(obj, impl, {
|
||||
value: new Impl.implementation(constructorArgs, privateData),
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
obj[impl][utils.wrapperSymbol] = obj;
|
||||
if (Impl.init) {
|
||||
Impl.init(obj[impl], privateData);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
interface: Attr,
|
||||
expose: {
|
||||
Window: { Attr }
|
||||
}
|
||||
}; // iface
|
||||
module.exports = iface;
|
||||
|
||||
const Impl = require("../attributes/Attr-impl.js");
|
116
node_modules/jsdom/lib/jsdom/living/generated/BarProp.js
generated
vendored
Normal file
116
node_modules/jsdom/lib/jsdom/living/generated/BarProp.js
generated
vendored
Normal file
|
@ -0,0 +1,116 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const impl = utils.implSymbol;
|
||||
|
||||
function BarProp() {
|
||||
throw new TypeError("Illegal constructor");
|
||||
}
|
||||
|
||||
Object.defineProperty(BarProp, "prototype", {
|
||||
value: BarProp.prototype,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: false
|
||||
});
|
||||
|
||||
Object.defineProperty(BarProp.prototype, "visible", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["visible"];
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(BarProp.prototype, Symbol.toStringTag, {
|
||||
value: "BarProp",
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
const iface = {
|
||||
// When an interface-module that implements this interface as a mixin is loaded, it will append its own `.is()`
|
||||
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
|
||||
// implementing this mixin interface.
|
||||
_mixedIntoPredicates: [],
|
||||
is(obj) {
|
||||
if (obj) {
|
||||
if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(obj)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
isImpl(obj) {
|
||||
if (obj) {
|
||||
if (obj instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const wrapper = utils.wrapperForImpl(obj);
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(wrapper)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (module.exports.is(obj)) {
|
||||
return utils.implForWrapper(obj);
|
||||
}
|
||||
throw new TypeError(`${context} is not of type 'BarProp'.`);
|
||||
},
|
||||
|
||||
create(constructorArgs, privateData) {
|
||||
let obj = Object.create(BarProp.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return obj;
|
||||
},
|
||||
createImpl(constructorArgs, privateData) {
|
||||
let obj = Object.create(BarProp.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return utils.implForWrapper(obj);
|
||||
},
|
||||
_internalSetup(obj) {},
|
||||
setup(obj, constructorArgs, privateData) {
|
||||
if (!privateData) privateData = {};
|
||||
|
||||
privateData.wrapper = obj;
|
||||
|
||||
this._internalSetup(obj);
|
||||
Object.defineProperty(obj, impl, {
|
||||
value: new Impl.implementation(constructorArgs, privateData),
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
obj[impl][utils.wrapperSymbol] = obj;
|
||||
if (Impl.init) {
|
||||
Impl.init(obj[impl], privateData);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
interface: BarProp,
|
||||
expose: {
|
||||
Window: { BarProp }
|
||||
}
|
||||
}; // iface
|
||||
module.exports = iface;
|
||||
|
||||
const Impl = require("../window/BarProp-impl.js");
|
13
node_modules/jsdom/lib/jsdom/living/generated/BinaryType.js
generated
vendored
Normal file
13
node_modules/jsdom/lib/jsdom/living/generated/BinaryType.js
generated
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
"use strict";
|
||||
|
||||
const enumerationValues = new Set(["blob", "arraybuffer"]);
|
||||
module.exports = {
|
||||
enumerationValues,
|
||||
convert(value, { context = "The provided value" } = {}) {
|
||||
const string = `${value}`;
|
||||
if (!enumerationValues.has(value)) {
|
||||
throw new TypeError(`${context} '${value}' is not a valid enumeration value for BinaryType`);
|
||||
}
|
||||
return string;
|
||||
}
|
||||
};
|
203
node_modules/jsdom/lib/jsdom/living/generated/Blob.js
generated
vendored
Normal file
203
node_modules/jsdom/lib/jsdom/living/generated/Blob.js
generated
vendored
Normal file
|
@ -0,0 +1,203 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const convertBlobPropertyBag = require("./BlobPropertyBag.js").convert;
|
||||
const impl = utils.implSymbol;
|
||||
|
||||
function Blob() {
|
||||
if (new.target === undefined) {
|
||||
throw new TypeError(
|
||||
"Failed to construct 'Blob'. Please use the 'new' operator; this constructor " + "cannot be called as a function."
|
||||
);
|
||||
}
|
||||
const args = [];
|
||||
{
|
||||
let curArg = arguments[0];
|
||||
if (curArg !== undefined) {
|
||||
if (!utils.isObject(curArg)) {
|
||||
throw new TypeError("Failed to construct 'Blob': parameter 1" + " is not an iterable object.");
|
||||
} else {
|
||||
const V = [];
|
||||
const tmp = curArg;
|
||||
for (let nextItem of tmp) {
|
||||
if (module.exports.is(nextItem)) {
|
||||
nextItem = utils.implForWrapper(nextItem);
|
||||
} else if (nextItem instanceof ArrayBuffer) {
|
||||
} else if (ArrayBuffer.isView(nextItem)) {
|
||||
} else {
|
||||
nextItem = conversions["USVString"](nextItem, {
|
||||
context: "Failed to construct 'Blob': parameter 1" + "'s element"
|
||||
});
|
||||
}
|
||||
V.push(nextItem);
|
||||
}
|
||||
curArg = V;
|
||||
}
|
||||
}
|
||||
args.push(curArg);
|
||||
}
|
||||
{
|
||||
let curArg = arguments[1];
|
||||
curArg = convertBlobPropertyBag(curArg, { context: "Failed to construct 'Blob': parameter 2" });
|
||||
args.push(curArg);
|
||||
}
|
||||
|
||||
iface.setup(this, args);
|
||||
}
|
||||
|
||||
Object.defineProperty(Blob, "prototype", {
|
||||
value: Blob.prototype,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: false
|
||||
});
|
||||
|
||||
Blob.prototype.slice = function slice() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
const args = [];
|
||||
{
|
||||
let curArg = arguments[0];
|
||||
if (curArg !== undefined) {
|
||||
curArg = conversions["long long"](curArg, {
|
||||
context: "Failed to execute 'slice' on 'Blob': parameter 1",
|
||||
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",
|
||||
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" });
|
||||
}
|
||||
args.push(curArg);
|
||||
}
|
||||
return utils.tryWrapperForImpl(this[impl].slice(...args));
|
||||
};
|
||||
|
||||
Object.defineProperty(Blob.prototype, "size", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["size"];
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(Blob.prototype, "type", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["type"];
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(Blob.prototype, Symbol.toStringTag, {
|
||||
value: "Blob",
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
const iface = {
|
||||
// When an interface-module that implements this interface as a mixin is loaded, it will append its own `.is()`
|
||||
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
|
||||
// implementing this mixin interface.
|
||||
_mixedIntoPredicates: [],
|
||||
is(obj) {
|
||||
if (obj) {
|
||||
if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(obj)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
isImpl(obj) {
|
||||
if (obj) {
|
||||
if (obj instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const wrapper = utils.wrapperForImpl(obj);
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(wrapper)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (module.exports.is(obj)) {
|
||||
return utils.implForWrapper(obj);
|
||||
}
|
||||
throw new TypeError(`${context} is not of type 'Blob'.`);
|
||||
},
|
||||
|
||||
create(constructorArgs, privateData) {
|
||||
let obj = Object.create(Blob.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return obj;
|
||||
},
|
||||
createImpl(constructorArgs, privateData) {
|
||||
let obj = Object.create(Blob.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return utils.implForWrapper(obj);
|
||||
},
|
||||
_internalSetup(obj) {},
|
||||
setup(obj, constructorArgs, privateData) {
|
||||
if (!privateData) privateData = {};
|
||||
|
||||
privateData.wrapper = obj;
|
||||
|
||||
this._internalSetup(obj);
|
||||
Object.defineProperty(obj, impl, {
|
||||
value: new Impl.implementation(constructorArgs, privateData),
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
obj[impl][utils.wrapperSymbol] = obj;
|
||||
if (Impl.init) {
|
||||
Impl.init(obj[impl], privateData);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
interface: Blob,
|
||||
expose: {
|
||||
Window: { Blob },
|
||||
Worker: { Blob }
|
||||
}
|
||||
}; // iface
|
||||
module.exports = iface;
|
||||
|
||||
const Impl = require("../file-api/Blob-impl.js");
|
44
node_modules/jsdom/lib/jsdom/living/generated/BlobPropertyBag.js
generated
vendored
Normal file
44
node_modules/jsdom/lib/jsdom/living/generated/BlobPropertyBag.js
generated
vendored
Normal file
|
@ -0,0 +1,44 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const convertEndingType = require("./EndingType.js").convert;
|
||||
|
||||
module.exports = {
|
||||
convertInherit(obj, ret, { context = "The provided value" } = {}) {
|
||||
{
|
||||
const key = "endings";
|
||||
let value = obj === undefined || obj === null ? undefined : obj[key];
|
||||
if (value !== undefined) {
|
||||
value = convertEndingType(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" });
|
||||
|
||||
ret[key] = value;
|
||||
} else {
|
||||
ret[key] = "";
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") {
|
||||
throw new TypeError(`${context} is not an object.`);
|
||||
}
|
||||
|
||||
const ret = Object.create(null);
|
||||
module.exports.convertInherit(obj, ret, { context });
|
||||
return ret;
|
||||
}
|
||||
};
|
109
node_modules/jsdom/lib/jsdom/living/generated/CDATASection.js
generated
vendored
Normal file
109
node_modules/jsdom/lib/jsdom/living/generated/CDATASection.js
generated
vendored
Normal file
|
@ -0,0 +1,109 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const impl = utils.implSymbol;
|
||||
const Text = require("./Text.js");
|
||||
|
||||
function CDATASection() {
|
||||
throw new TypeError("Illegal constructor");
|
||||
}
|
||||
|
||||
Object.setPrototypeOf(CDATASection.prototype, Text.interface.prototype);
|
||||
Object.setPrototypeOf(CDATASection, Text.interface);
|
||||
|
||||
Object.defineProperty(CDATASection, "prototype", {
|
||||
value: CDATASection.prototype,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: false
|
||||
});
|
||||
|
||||
Object.defineProperty(CDATASection.prototype, Symbol.toStringTag, {
|
||||
value: "CDATASection",
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
const iface = {
|
||||
// When an interface-module that implements this interface as a mixin is loaded, it will append its own `.is()`
|
||||
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
|
||||
// implementing this mixin interface.
|
||||
_mixedIntoPredicates: [],
|
||||
is(obj) {
|
||||
if (obj) {
|
||||
if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(obj)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
isImpl(obj) {
|
||||
if (obj) {
|
||||
if (obj instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const wrapper = utils.wrapperForImpl(obj);
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(wrapper)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (module.exports.is(obj)) {
|
||||
return utils.implForWrapper(obj);
|
||||
}
|
||||
throw new TypeError(`${context} is not of type 'CDATASection'.`);
|
||||
},
|
||||
|
||||
create(constructorArgs, privateData) {
|
||||
let obj = Object.create(CDATASection.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return obj;
|
||||
},
|
||||
createImpl(constructorArgs, privateData) {
|
||||
let obj = Object.create(CDATASection.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return utils.implForWrapper(obj);
|
||||
},
|
||||
_internalSetup(obj) {
|
||||
Text._internalSetup(obj);
|
||||
},
|
||||
setup(obj, constructorArgs, privateData) {
|
||||
if (!privateData) privateData = {};
|
||||
|
||||
privateData.wrapper = obj;
|
||||
|
||||
this._internalSetup(obj);
|
||||
Object.defineProperty(obj, impl, {
|
||||
value: new Impl.implementation(constructorArgs, privateData),
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
obj[impl][utils.wrapperSymbol] = obj;
|
||||
if (Impl.init) {
|
||||
Impl.init(obj[impl], privateData);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
interface: CDATASection,
|
||||
expose: {
|
||||
Window: { CDATASection }
|
||||
}
|
||||
}; // iface
|
||||
module.exports = iface;
|
||||
|
||||
const Impl = require("../nodes/CDATASection-impl.js");
|
13
node_modules/jsdom/lib/jsdom/living/generated/CanPlayTypeResult.js
generated
vendored
Normal file
13
node_modules/jsdom/lib/jsdom/living/generated/CanPlayTypeResult.js
generated
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
"use strict";
|
||||
|
||||
const enumerationValues = new Set(["", "maybe", "probably"]);
|
||||
module.exports = {
|
||||
enumerationValues,
|
||||
convert(value, { context = "The provided value" } = {}) {
|
||||
const string = `${value}`;
|
||||
if (!enumerationValues.has(value)) {
|
||||
throw new TypeError(`${context} '${value}' is not a valid enumeration value for CanPlayTypeResult`);
|
||||
}
|
||||
return string;
|
||||
}
|
||||
};
|
396
node_modules/jsdom/lib/jsdom/living/generated/CharacterData.js
generated
vendored
Normal file
396
node_modules/jsdom/lib/jsdom/living/generated/CharacterData.js
generated
vendored
Normal file
|
@ -0,0 +1,396 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const isNode = require("./Node.js").is;
|
||||
const impl = utils.implSymbol;
|
||||
const Node = require("./Node.js");
|
||||
const ChildNode = require("./ChildNode.js");
|
||||
const NonDocumentTypeChildNode = require("./NonDocumentTypeChildNode.js");
|
||||
|
||||
function CharacterData() {
|
||||
throw new TypeError("Illegal constructor");
|
||||
}
|
||||
|
||||
Object.setPrototypeOf(CharacterData.prototype, Node.interface.prototype);
|
||||
Object.setPrototypeOf(CharacterData, Node.interface);
|
||||
|
||||
Object.defineProperty(CharacterData, "prototype", {
|
||||
value: CharacterData.prototype,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: false
|
||||
});
|
||||
|
||||
CharacterData.prototype.substringData = function substringData(offset, count) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
if (arguments.length < 2) {
|
||||
throw new 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"
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
{
|
||||
let curArg = arguments[1];
|
||||
curArg = conversions["unsigned long"](curArg, {
|
||||
context: "Failed to execute 'substringData' on 'CharacterData': parameter 2"
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
return this[impl].substringData(...args);
|
||||
};
|
||||
|
||||
CharacterData.prototype.appendData = function appendData(data) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
if (arguments.length < 1) {
|
||||
throw new 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"
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
return this[impl].appendData(...args);
|
||||
};
|
||||
|
||||
CharacterData.prototype.insertData = function insertData(offset, data) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
if (arguments.length < 2) {
|
||||
throw new 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"
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
{
|
||||
let curArg = arguments[1];
|
||||
curArg = conversions["DOMString"](curArg, {
|
||||
context: "Failed to execute 'insertData' on 'CharacterData': parameter 2"
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
return this[impl].insertData(...args);
|
||||
};
|
||||
|
||||
CharacterData.prototype.deleteData = function deleteData(offset, count) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
if (arguments.length < 2) {
|
||||
throw new 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"
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
{
|
||||
let curArg = arguments[1];
|
||||
curArg = conversions["unsigned long"](curArg, {
|
||||
context: "Failed to execute 'deleteData' on 'CharacterData': parameter 2"
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
return this[impl].deleteData(...args);
|
||||
};
|
||||
|
||||
CharacterData.prototype.replaceData = function replaceData(offset, count, data) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
if (arguments.length < 3) {
|
||||
throw new 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"
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
{
|
||||
let curArg = arguments[1];
|
||||
curArg = conversions["unsigned long"](curArg, {
|
||||
context: "Failed to execute 'replaceData' on 'CharacterData': parameter 2"
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
{
|
||||
let curArg = arguments[2];
|
||||
curArg = conversions["DOMString"](curArg, {
|
||||
context: "Failed to execute 'replaceData' on 'CharacterData': parameter 3"
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
return this[impl].replaceData(...args);
|
||||
};
|
||||
|
||||
CharacterData.prototype.before = function before() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
const args = [];
|
||||
for (let i = 0; i < arguments.length; i++) {
|
||||
let curArg = arguments[i];
|
||||
if (isNode(curArg)) {
|
||||
curArg = utils.implForWrapper(curArg);
|
||||
} else {
|
||||
curArg = conversions["DOMString"](curArg, {
|
||||
context: "Failed to execute 'before' on 'CharacterData': parameter " + (i + 1)
|
||||
});
|
||||
}
|
||||
args.push(curArg);
|
||||
}
|
||||
return this[impl].before(...args);
|
||||
};
|
||||
|
||||
CharacterData.prototype.after = function after() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
const args = [];
|
||||
for (let i = 0; i < arguments.length; i++) {
|
||||
let curArg = arguments[i];
|
||||
if (isNode(curArg)) {
|
||||
curArg = utils.implForWrapper(curArg);
|
||||
} else {
|
||||
curArg = conversions["DOMString"](curArg, {
|
||||
context: "Failed to execute 'after' on 'CharacterData': parameter " + (i + 1)
|
||||
});
|
||||
}
|
||||
args.push(curArg);
|
||||
}
|
||||
return this[impl].after(...args);
|
||||
};
|
||||
|
||||
CharacterData.prototype.replaceWith = function replaceWith() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
const args = [];
|
||||
for (let i = 0; i < arguments.length; i++) {
|
||||
let curArg = arguments[i];
|
||||
if (isNode(curArg)) {
|
||||
curArg = utils.implForWrapper(curArg);
|
||||
} else {
|
||||
curArg = conversions["DOMString"](curArg, {
|
||||
context: "Failed to execute 'replaceWith' on 'CharacterData': parameter " + (i + 1)
|
||||
});
|
||||
}
|
||||
args.push(curArg);
|
||||
}
|
||||
return this[impl].replaceWith(...args);
|
||||
};
|
||||
|
||||
CharacterData.prototype.remove = function remove() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl].remove();
|
||||
};
|
||||
|
||||
Object.defineProperty(CharacterData.prototype, "data", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["data"];
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["DOMString"](V, {
|
||||
context: "Failed to set the 'data' property on 'CharacterData': The provided value",
|
||||
treatNullAsEmptyString: true
|
||||
});
|
||||
|
||||
this[impl]["data"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(CharacterData.prototype, "length", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["length"];
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(CharacterData.prototype, "previousElementSibling", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return utils.tryWrapperForImpl(this[impl]["previousElementSibling"]);
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(CharacterData.prototype, "nextElementSibling", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return utils.tryWrapperForImpl(this[impl]["nextElementSibling"]);
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(CharacterData.prototype, Symbol.toStringTag, {
|
||||
value: "CharacterData",
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
const iface = {
|
||||
// When an interface-module that implements this interface as a mixin is loaded, it will append its own `.is()`
|
||||
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
|
||||
// implementing this mixin interface.
|
||||
_mixedIntoPredicates: [],
|
||||
is(obj) {
|
||||
if (obj) {
|
||||
if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(obj)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
isImpl(obj) {
|
||||
if (obj) {
|
||||
if (obj instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const wrapper = utils.wrapperForImpl(obj);
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(wrapper)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (module.exports.is(obj)) {
|
||||
return utils.implForWrapper(obj);
|
||||
}
|
||||
throw new TypeError(`${context} is not of type 'CharacterData'.`);
|
||||
},
|
||||
|
||||
create(constructorArgs, privateData) {
|
||||
let obj = Object.create(CharacterData.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return obj;
|
||||
},
|
||||
createImpl(constructorArgs, privateData) {
|
||||
let obj = Object.create(CharacterData.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return utils.implForWrapper(obj);
|
||||
},
|
||||
_internalSetup(obj) {
|
||||
Node._internalSetup(obj);
|
||||
},
|
||||
setup(obj, constructorArgs, privateData) {
|
||||
if (!privateData) privateData = {};
|
||||
|
||||
privateData.wrapper = obj;
|
||||
|
||||
this._internalSetup(obj);
|
||||
Object.defineProperty(obj, impl, {
|
||||
value: new Impl.implementation(constructorArgs, privateData),
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
obj[impl][utils.wrapperSymbol] = obj;
|
||||
if (Impl.init) {
|
||||
Impl.init(obj[impl], privateData);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
interface: CharacterData,
|
||||
expose: {
|
||||
Window: { CharacterData }
|
||||
}
|
||||
}; // iface
|
||||
module.exports = iface;
|
||||
|
||||
ChildNode._mixedIntoPredicates.push(module.exports.is);
|
||||
|
||||
NonDocumentTypeChildNode._mixedIntoPredicates.push(module.exports.is);
|
||||
|
||||
const Impl = require("../nodes/CharacterData-impl.js");
|
179
node_modules/jsdom/lib/jsdom/living/generated/ChildNode.js
generated
vendored
Normal file
179
node_modules/jsdom/lib/jsdom/living/generated/ChildNode.js
generated
vendored
Normal file
|
@ -0,0 +1,179 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const isNode = require("./Node.js").is;
|
||||
const impl = utils.implSymbol;
|
||||
|
||||
function ChildNode() {
|
||||
throw new TypeError("Illegal constructor");
|
||||
}
|
||||
|
||||
Object.defineProperty(ChildNode, "prototype", {
|
||||
value: ChildNode.prototype,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: false
|
||||
});
|
||||
|
||||
ChildNode.prototype.before = function before() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
const args = [];
|
||||
for (let i = 0; i < arguments.length; i++) {
|
||||
let curArg = arguments[i];
|
||||
if (isNode(curArg)) {
|
||||
curArg = utils.implForWrapper(curArg);
|
||||
} else {
|
||||
curArg = conversions["DOMString"](curArg, {
|
||||
context: "Failed to execute 'before' on 'ChildNode': parameter " + (i + 1)
|
||||
});
|
||||
}
|
||||
args.push(curArg);
|
||||
}
|
||||
return this[impl].before(...args);
|
||||
};
|
||||
|
||||
ChildNode.prototype.after = function after() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
const args = [];
|
||||
for (let i = 0; i < arguments.length; i++) {
|
||||
let curArg = arguments[i];
|
||||
if (isNode(curArg)) {
|
||||
curArg = utils.implForWrapper(curArg);
|
||||
} else {
|
||||
curArg = conversions["DOMString"](curArg, {
|
||||
context: "Failed to execute 'after' on 'ChildNode': parameter " + (i + 1)
|
||||
});
|
||||
}
|
||||
args.push(curArg);
|
||||
}
|
||||
return this[impl].after(...args);
|
||||
};
|
||||
|
||||
ChildNode.prototype.replaceWith = function replaceWith() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
const args = [];
|
||||
for (let i = 0; i < arguments.length; i++) {
|
||||
let curArg = arguments[i];
|
||||
if (isNode(curArg)) {
|
||||
curArg = utils.implForWrapper(curArg);
|
||||
} else {
|
||||
curArg = conversions["DOMString"](curArg, {
|
||||
context: "Failed to execute 'replaceWith' on 'ChildNode': parameter " + (i + 1)
|
||||
});
|
||||
}
|
||||
args.push(curArg);
|
||||
}
|
||||
return this[impl].replaceWith(...args);
|
||||
};
|
||||
|
||||
ChildNode.prototype.remove = function remove() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl].remove();
|
||||
};
|
||||
|
||||
Object.defineProperty(ChildNode.prototype, Symbol.unscopables, {
|
||||
value: {
|
||||
before: true,
|
||||
after: true,
|
||||
replaceWith: true,
|
||||
remove: true
|
||||
},
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(ChildNode.prototype, Symbol.toStringTag, {
|
||||
value: "ChildNode",
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
const iface = {
|
||||
// When an interface-module that implements this interface as a mixin is loaded, it will append its own `.is()`
|
||||
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
|
||||
// implementing this mixin interface.
|
||||
_mixedIntoPredicates: [],
|
||||
is(obj) {
|
||||
if (obj) {
|
||||
if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(obj)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
isImpl(obj) {
|
||||
if (obj) {
|
||||
if (obj instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const wrapper = utils.wrapperForImpl(obj);
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(wrapper)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (module.exports.is(obj)) {
|
||||
return utils.implForWrapper(obj);
|
||||
}
|
||||
throw new TypeError(`${context} is not of type 'ChildNode'.`);
|
||||
},
|
||||
|
||||
create(constructorArgs, privateData) {
|
||||
let obj = Object.create(ChildNode.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return obj;
|
||||
},
|
||||
createImpl(constructorArgs, privateData) {
|
||||
let obj = Object.create(ChildNode.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return utils.implForWrapper(obj);
|
||||
},
|
||||
_internalSetup(obj) {},
|
||||
setup(obj, constructorArgs, privateData) {
|
||||
if (!privateData) privateData = {};
|
||||
|
||||
privateData.wrapper = obj;
|
||||
|
||||
this._internalSetup(obj);
|
||||
Object.defineProperty(obj, impl, {
|
||||
value: new Impl.implementation(constructorArgs, privateData),
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
obj[impl][utils.wrapperSymbol] = obj;
|
||||
if (Impl.init) {
|
||||
Impl.init(obj[impl], privateData);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
interface: ChildNode,
|
||||
expose: {}
|
||||
}; // iface
|
||||
module.exports = iface;
|
||||
|
||||
const Impl = require("../nodes/ChildNode-impl.js");
|
174
node_modules/jsdom/lib/jsdom/living/generated/CloseEvent.js
generated
vendored
Normal file
174
node_modules/jsdom/lib/jsdom/living/generated/CloseEvent.js
generated
vendored
Normal file
|
@ -0,0 +1,174 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const convertCloseEventInit = require("./CloseEventInit.js").convert;
|
||||
const impl = utils.implSymbol;
|
||||
const Event = require("./Event.js");
|
||||
|
||||
function CloseEvent(type) {
|
||||
if (new.target === undefined) {
|
||||
throw new TypeError(
|
||||
"Failed to construct 'CloseEvent'. Please use the 'new' operator; this constructor " +
|
||||
"cannot be called as a function."
|
||||
);
|
||||
}
|
||||
|
||||
if (arguments.length < 1) {
|
||||
throw new 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" });
|
||||
args.push(curArg);
|
||||
}
|
||||
{
|
||||
let curArg = arguments[1];
|
||||
curArg = convertCloseEventInit(curArg, { context: "Failed to construct 'CloseEvent': parameter 2" });
|
||||
args.push(curArg);
|
||||
}
|
||||
|
||||
iface.setup(this, args);
|
||||
}
|
||||
|
||||
Object.setPrototypeOf(CloseEvent.prototype, Event.interface.prototype);
|
||||
Object.setPrototypeOf(CloseEvent, Event.interface);
|
||||
|
||||
Object.defineProperty(CloseEvent, "prototype", {
|
||||
value: CloseEvent.prototype,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: false
|
||||
});
|
||||
|
||||
Object.defineProperty(CloseEvent.prototype, "wasClean", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["wasClean"];
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(CloseEvent.prototype, "code", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["code"];
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(CloseEvent.prototype, "reason", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["reason"];
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(CloseEvent.prototype, Symbol.toStringTag, {
|
||||
value: "CloseEvent",
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
const iface = {
|
||||
// When an interface-module that implements this interface as a mixin is loaded, it will append its own `.is()`
|
||||
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
|
||||
// implementing this mixin interface.
|
||||
_mixedIntoPredicates: [],
|
||||
is(obj) {
|
||||
if (obj) {
|
||||
if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(obj)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
isImpl(obj) {
|
||||
if (obj) {
|
||||
if (obj instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const wrapper = utils.wrapperForImpl(obj);
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(wrapper)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (module.exports.is(obj)) {
|
||||
return utils.implForWrapper(obj);
|
||||
}
|
||||
throw new TypeError(`${context} is not of type 'CloseEvent'.`);
|
||||
},
|
||||
|
||||
create(constructorArgs, privateData) {
|
||||
let obj = Object.create(CloseEvent.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return obj;
|
||||
},
|
||||
createImpl(constructorArgs, privateData) {
|
||||
let obj = Object.create(CloseEvent.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return utils.implForWrapper(obj);
|
||||
},
|
||||
_internalSetup(obj) {
|
||||
Event._internalSetup(obj);
|
||||
},
|
||||
setup(obj, constructorArgs, privateData) {
|
||||
if (!privateData) privateData = {};
|
||||
|
||||
privateData.wrapper = obj;
|
||||
|
||||
this._internalSetup(obj);
|
||||
Object.defineProperty(obj, impl, {
|
||||
value: new Impl.implementation(constructorArgs, privateData),
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
obj[impl][utils.wrapperSymbol] = obj;
|
||||
if (Impl.init) {
|
||||
Impl.init(obj[impl], privateData);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
interface: CloseEvent,
|
||||
expose: {
|
||||
Window: { CloseEvent },
|
||||
Worker: { CloseEvent }
|
||||
}
|
||||
}; // iface
|
||||
module.exports = iface;
|
||||
|
||||
const Impl = require("../events/CloseEvent-impl.js");
|
58
node_modules/jsdom/lib/jsdom/living/generated/CloseEventInit.js
generated
vendored
Normal file
58
node_modules/jsdom/lib/jsdom/living/generated/CloseEventInit.js
generated
vendored
Normal file
|
@ -0,0 +1,58 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const EventInit = require("./EventInit.js");
|
||||
|
||||
module.exports = {
|
||||
convertInherit(obj, ret, { context = "The provided value" } = {}) {
|
||||
EventInit.convertInherit(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" });
|
||||
|
||||
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" });
|
||||
|
||||
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" });
|
||||
|
||||
ret[key] = value;
|
||||
} else {
|
||||
ret[key] = false;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") {
|
||||
throw new TypeError(`${context} is not an object.`);
|
||||
}
|
||||
|
||||
const ret = Object.create(null);
|
||||
module.exports.convertInherit(obj, ret, { context });
|
||||
return ret;
|
||||
}
|
||||
};
|
126
node_modules/jsdom/lib/jsdom/living/generated/Comment.js
generated
vendored
Normal file
126
node_modules/jsdom/lib/jsdom/living/generated/Comment.js
generated
vendored
Normal file
|
@ -0,0 +1,126 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const impl = utils.implSymbol;
|
||||
const CharacterData = require("./CharacterData.js");
|
||||
|
||||
function Comment() {
|
||||
if (new.target === undefined) {
|
||||
throw new TypeError(
|
||||
"Failed to construct 'Comment'. Please use the 'new' operator; this constructor " +
|
||||
"cannot be called as a function."
|
||||
);
|
||||
}
|
||||
const args = [];
|
||||
{
|
||||
let curArg = arguments[0];
|
||||
if (curArg !== undefined) {
|
||||
curArg = conversions["DOMString"](curArg, { context: "Failed to construct 'Comment': parameter 1" });
|
||||
} else {
|
||||
curArg = "";
|
||||
}
|
||||
args.push(curArg);
|
||||
}
|
||||
|
||||
iface.setup(this, args);
|
||||
}
|
||||
|
||||
Object.setPrototypeOf(Comment.prototype, CharacterData.interface.prototype);
|
||||
Object.setPrototypeOf(Comment, CharacterData.interface);
|
||||
|
||||
Object.defineProperty(Comment, "prototype", {
|
||||
value: Comment.prototype,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: false
|
||||
});
|
||||
|
||||
Object.defineProperty(Comment.prototype, Symbol.toStringTag, {
|
||||
value: "Comment",
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
const iface = {
|
||||
// When an interface-module that implements this interface as a mixin is loaded, it will append its own `.is()`
|
||||
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
|
||||
// implementing this mixin interface.
|
||||
_mixedIntoPredicates: [],
|
||||
is(obj) {
|
||||
if (obj) {
|
||||
if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(obj)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
isImpl(obj) {
|
||||
if (obj) {
|
||||
if (obj instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const wrapper = utils.wrapperForImpl(obj);
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(wrapper)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (module.exports.is(obj)) {
|
||||
return utils.implForWrapper(obj);
|
||||
}
|
||||
throw new TypeError(`${context} is not of type 'Comment'.`);
|
||||
},
|
||||
|
||||
create(constructorArgs, privateData) {
|
||||
let obj = Object.create(Comment.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return obj;
|
||||
},
|
||||
createImpl(constructorArgs, privateData) {
|
||||
let obj = Object.create(Comment.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return utils.implForWrapper(obj);
|
||||
},
|
||||
_internalSetup(obj) {
|
||||
CharacterData._internalSetup(obj);
|
||||
},
|
||||
setup(obj, constructorArgs, privateData) {
|
||||
if (!privateData) privateData = {};
|
||||
|
||||
privateData.wrapper = obj;
|
||||
|
||||
this._internalSetup(obj);
|
||||
Object.defineProperty(obj, impl, {
|
||||
value: new Impl.implementation(constructorArgs, privateData),
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
obj[impl][utils.wrapperSymbol] = obj;
|
||||
if (Impl.init) {
|
||||
Impl.init(obj[impl], privateData);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
interface: Comment,
|
||||
expose: {
|
||||
Window: { Comment }
|
||||
}
|
||||
}; // iface
|
||||
module.exports = iface;
|
||||
|
||||
const Impl = require("../nodes/Comment-impl.js");
|
216
node_modules/jsdom/lib/jsdom/living/generated/CompositionEvent.js
generated
vendored
Normal file
216
node_modules/jsdom/lib/jsdom/living/generated/CompositionEvent.js
generated
vendored
Normal file
|
@ -0,0 +1,216 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const convertCompositionEventInit = require("./CompositionEventInit.js").convert;
|
||||
const impl = utils.implSymbol;
|
||||
const UIEvent = require("./UIEvent.js");
|
||||
|
||||
function CompositionEvent(type) {
|
||||
if (new.target === undefined) {
|
||||
throw new TypeError(
|
||||
"Failed to construct 'CompositionEvent'. Please use the 'new' operator; this constructor " +
|
||||
"cannot be called as a function."
|
||||
);
|
||||
}
|
||||
|
||||
if (arguments.length < 1) {
|
||||
throw new 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" });
|
||||
args.push(curArg);
|
||||
}
|
||||
{
|
||||
let curArg = arguments[1];
|
||||
curArg = convertCompositionEventInit(curArg, { context: "Failed to construct 'CompositionEvent': parameter 2" });
|
||||
args.push(curArg);
|
||||
}
|
||||
|
||||
iface.setup(this, args);
|
||||
}
|
||||
|
||||
Object.setPrototypeOf(CompositionEvent.prototype, UIEvent.interface.prototype);
|
||||
Object.setPrototypeOf(CompositionEvent, UIEvent.interface);
|
||||
|
||||
Object.defineProperty(CompositionEvent, "prototype", {
|
||||
value: CompositionEvent.prototype,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: false
|
||||
});
|
||||
|
||||
CompositionEvent.prototype.initCompositionEvent = function initCompositionEvent(typeArg) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
if (arguments.length < 1) {
|
||||
throw new 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"
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
{
|
||||
let curArg = arguments[1];
|
||||
if (curArg !== undefined) {
|
||||
curArg = conversions["boolean"](curArg, {
|
||||
context: "Failed to execute 'initCompositionEvent' on 'CompositionEvent': parameter 2"
|
||||
});
|
||||
} 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"
|
||||
});
|
||||
} 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"
|
||||
});
|
||||
} else {
|
||||
curArg = "";
|
||||
}
|
||||
args.push(curArg);
|
||||
}
|
||||
return this[impl].initCompositionEvent(...args);
|
||||
};
|
||||
|
||||
Object.defineProperty(CompositionEvent.prototype, "data", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["data"];
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(CompositionEvent.prototype, Symbol.toStringTag, {
|
||||
value: "CompositionEvent",
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
const iface = {
|
||||
// When an interface-module that implements this interface as a mixin is loaded, it will append its own `.is()`
|
||||
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
|
||||
// implementing this mixin interface.
|
||||
_mixedIntoPredicates: [],
|
||||
is(obj) {
|
||||
if (obj) {
|
||||
if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(obj)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
isImpl(obj) {
|
||||
if (obj) {
|
||||
if (obj instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const wrapper = utils.wrapperForImpl(obj);
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(wrapper)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (module.exports.is(obj)) {
|
||||
return utils.implForWrapper(obj);
|
||||
}
|
||||
throw new TypeError(`${context} is not of type 'CompositionEvent'.`);
|
||||
},
|
||||
|
||||
create(constructorArgs, privateData) {
|
||||
let obj = Object.create(CompositionEvent.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return obj;
|
||||
},
|
||||
createImpl(constructorArgs, privateData) {
|
||||
let obj = Object.create(CompositionEvent.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return utils.implForWrapper(obj);
|
||||
},
|
||||
_internalSetup(obj) {
|
||||
UIEvent._internalSetup(obj);
|
||||
},
|
||||
setup(obj, constructorArgs, privateData) {
|
||||
if (!privateData) privateData = {};
|
||||
|
||||
privateData.wrapper = obj;
|
||||
|
||||
this._internalSetup(obj);
|
||||
Object.defineProperty(obj, impl, {
|
||||
value: new Impl.implementation(constructorArgs, privateData),
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
obj[impl][utils.wrapperSymbol] = obj;
|
||||
if (Impl.init) {
|
||||
Impl.init(obj[impl], privateData);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
interface: CompositionEvent,
|
||||
expose: {
|
||||
Window: { CompositionEvent }
|
||||
}
|
||||
}; // iface
|
||||
module.exports = iface;
|
||||
|
||||
const Impl = require("../events/CompositionEvent-impl.js");
|
34
node_modules/jsdom/lib/jsdom/living/generated/CompositionEventInit.js
generated
vendored
Normal file
34
node_modules/jsdom/lib/jsdom/living/generated/CompositionEventInit.js
generated
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const UIEventInit = require("./UIEventInit.js");
|
||||
|
||||
module.exports = {
|
||||
convertInherit(obj, ret, { context = "The provided value" } = {}) {
|
||||
UIEventInit.convertInherit(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" });
|
||||
|
||||
ret[key] = value;
|
||||
} else {
|
||||
ret[key] = "";
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") {
|
||||
throw new TypeError(`${context} is not an object.`);
|
||||
}
|
||||
|
||||
const ret = Object.create(null);
|
||||
module.exports.convertInherit(obj, ret, { context });
|
||||
return ret;
|
||||
}
|
||||
};
|
204
node_modules/jsdom/lib/jsdom/living/generated/CustomEvent.js
generated
vendored
Normal file
204
node_modules/jsdom/lib/jsdom/living/generated/CustomEvent.js
generated
vendored
Normal file
|
@ -0,0 +1,204 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const convertCustomEventInit = require("./CustomEventInit.js").convert;
|
||||
const impl = utils.implSymbol;
|
||||
const Event = require("./Event.js");
|
||||
|
||||
function CustomEvent(type) {
|
||||
if (new.target === undefined) {
|
||||
throw new TypeError(
|
||||
"Failed to construct 'CustomEvent'. Please use the 'new' operator; this constructor " +
|
||||
"cannot be called as a function."
|
||||
);
|
||||
}
|
||||
|
||||
if (arguments.length < 1) {
|
||||
throw new 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" });
|
||||
args.push(curArg);
|
||||
}
|
||||
{
|
||||
let curArg = arguments[1];
|
||||
curArg = convertCustomEventInit(curArg, { context: "Failed to construct 'CustomEvent': parameter 2" });
|
||||
args.push(curArg);
|
||||
}
|
||||
|
||||
iface.setup(this, args);
|
||||
}
|
||||
|
||||
Object.setPrototypeOf(CustomEvent.prototype, Event.interface.prototype);
|
||||
Object.setPrototypeOf(CustomEvent, Event.interface);
|
||||
|
||||
Object.defineProperty(CustomEvent, "prototype", {
|
||||
value: CustomEvent.prototype,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: false
|
||||
});
|
||||
|
||||
CustomEvent.prototype.initCustomEvent = function initCustomEvent(type) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
if (arguments.length < 1) {
|
||||
throw new 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"
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
{
|
||||
let curArg = arguments[1];
|
||||
if (curArg !== undefined) {
|
||||
curArg = conversions["boolean"](curArg, {
|
||||
context: "Failed to execute 'initCustomEvent' on 'CustomEvent': parameter 2"
|
||||
});
|
||||
} 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"
|
||||
});
|
||||
} 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"
|
||||
});
|
||||
} else {
|
||||
curArg = null;
|
||||
}
|
||||
args.push(curArg);
|
||||
}
|
||||
return this[impl].initCustomEvent(...args);
|
||||
};
|
||||
|
||||
Object.defineProperty(CustomEvent.prototype, "detail", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["detail"];
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(CustomEvent.prototype, Symbol.toStringTag, {
|
||||
value: "CustomEvent",
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
const iface = {
|
||||
// When an interface-module that implements this interface as a mixin is loaded, it will append its own `.is()`
|
||||
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
|
||||
// implementing this mixin interface.
|
||||
_mixedIntoPredicates: [],
|
||||
is(obj) {
|
||||
if (obj) {
|
||||
if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(obj)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
isImpl(obj) {
|
||||
if (obj) {
|
||||
if (obj instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const wrapper = utils.wrapperForImpl(obj);
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(wrapper)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (module.exports.is(obj)) {
|
||||
return utils.implForWrapper(obj);
|
||||
}
|
||||
throw new TypeError(`${context} is not of type 'CustomEvent'.`);
|
||||
},
|
||||
|
||||
create(constructorArgs, privateData) {
|
||||
let obj = Object.create(CustomEvent.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return obj;
|
||||
},
|
||||
createImpl(constructorArgs, privateData) {
|
||||
let obj = Object.create(CustomEvent.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return utils.implForWrapper(obj);
|
||||
},
|
||||
_internalSetup(obj) {
|
||||
Event._internalSetup(obj);
|
||||
},
|
||||
setup(obj, constructorArgs, privateData) {
|
||||
if (!privateData) privateData = {};
|
||||
|
||||
privateData.wrapper = obj;
|
||||
|
||||
this._internalSetup(obj);
|
||||
Object.defineProperty(obj, impl, {
|
||||
value: new Impl.implementation(constructorArgs, privateData),
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
obj[impl][utils.wrapperSymbol] = obj;
|
||||
if (Impl.init) {
|
||||
Impl.init(obj[impl], privateData);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
interface: CustomEvent,
|
||||
expose: {
|
||||
Window: { CustomEvent },
|
||||
Worker: { CustomEvent }
|
||||
}
|
||||
}; // iface
|
||||
module.exports = iface;
|
||||
|
||||
const Impl = require("../events/CustomEvent-impl.js");
|
34
node_modules/jsdom/lib/jsdom/living/generated/CustomEventInit.js
generated
vendored
Normal file
34
node_modules/jsdom/lib/jsdom/living/generated/CustomEventInit.js
generated
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const EventInit = require("./EventInit.js");
|
||||
|
||||
module.exports = {
|
||||
convertInherit(obj, ret, { context = "The provided value" } = {}) {
|
||||
EventInit.convertInherit(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" });
|
||||
|
||||
ret[key] = value;
|
||||
} else {
|
||||
ret[key] = null;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") {
|
||||
throw new TypeError(`${context} is not an object.`);
|
||||
}
|
||||
|
||||
const ret = Object.create(null);
|
||||
module.exports.convertInherit(obj, ret, { context });
|
||||
return ret;
|
||||
}
|
||||
};
|
216
node_modules/jsdom/lib/jsdom/living/generated/DOMImplementation.js
generated
vendored
Normal file
216
node_modules/jsdom/lib/jsdom/living/generated/DOMImplementation.js
generated
vendored
Normal file
|
@ -0,0 +1,216 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const convertDocumentType = require("./DocumentType.js").convert;
|
||||
const impl = utils.implSymbol;
|
||||
|
||||
function DOMImplementation() {
|
||||
throw new TypeError("Illegal constructor");
|
||||
}
|
||||
|
||||
Object.defineProperty(DOMImplementation, "prototype", {
|
||||
value: DOMImplementation.prototype,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: false
|
||||
});
|
||||
|
||||
DOMImplementation.prototype.createDocumentType = function createDocumentType(qualifiedName, publicId, systemId) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
if (arguments.length < 3) {
|
||||
throw new 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"
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
{
|
||||
let curArg = arguments[1];
|
||||
curArg = conversions["DOMString"](curArg, {
|
||||
context: "Failed to execute 'createDocumentType' on 'DOMImplementation': parameter 2"
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
{
|
||||
let curArg = arguments[2];
|
||||
curArg = conversions["DOMString"](curArg, {
|
||||
context: "Failed to execute 'createDocumentType' on 'DOMImplementation': parameter 3"
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
return utils.tryWrapperForImpl(this[impl].createDocumentType(...args));
|
||||
};
|
||||
|
||||
DOMImplementation.prototype.createDocument = function createDocument(namespace, qualifiedName) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
if (arguments.length < 2) {
|
||||
throw new 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"
|
||||
});
|
||||
}
|
||||
args.push(curArg);
|
||||
}
|
||||
{
|
||||
let curArg = arguments[1];
|
||||
curArg = conversions["DOMString"](curArg, {
|
||||
context: "Failed to execute 'createDocument' on 'DOMImplementation': parameter 2",
|
||||
treatNullAsEmptyString: true
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
{
|
||||
let curArg = arguments[2];
|
||||
if (curArg !== undefined) {
|
||||
if (curArg === null || curArg === undefined) {
|
||||
curArg = null;
|
||||
} else {
|
||||
curArg = convertDocumentType(curArg, {
|
||||
context: "Failed to execute 'createDocument' on 'DOMImplementation': parameter 3"
|
||||
});
|
||||
}
|
||||
} else {
|
||||
curArg = null;
|
||||
}
|
||||
args.push(curArg);
|
||||
}
|
||||
return utils.tryWrapperForImpl(this[impl].createDocument(...args));
|
||||
};
|
||||
|
||||
DOMImplementation.prototype.createHTMLDocument = function createHTMLDocument() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
const args = [];
|
||||
{
|
||||
let curArg = arguments[0];
|
||||
if (curArg !== undefined) {
|
||||
curArg = conversions["DOMString"](curArg, {
|
||||
context: "Failed to execute 'createHTMLDocument' on 'DOMImplementation': parameter 1"
|
||||
});
|
||||
}
|
||||
args.push(curArg);
|
||||
}
|
||||
return utils.tryWrapperForImpl(this[impl].createHTMLDocument(...args));
|
||||
};
|
||||
|
||||
DOMImplementation.prototype.hasFeature = function hasFeature() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl].hasFeature();
|
||||
};
|
||||
|
||||
Object.defineProperty(DOMImplementation.prototype, Symbol.toStringTag, {
|
||||
value: "DOMImplementation",
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
const iface = {
|
||||
// When an interface-module that implements this interface as a mixin is loaded, it will append its own `.is()`
|
||||
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
|
||||
// implementing this mixin interface.
|
||||
_mixedIntoPredicates: [],
|
||||
is(obj) {
|
||||
if (obj) {
|
||||
if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(obj)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
isImpl(obj) {
|
||||
if (obj) {
|
||||
if (obj instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const wrapper = utils.wrapperForImpl(obj);
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(wrapper)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (module.exports.is(obj)) {
|
||||
return utils.implForWrapper(obj);
|
||||
}
|
||||
throw new TypeError(`${context} is not of type 'DOMImplementation'.`);
|
||||
},
|
||||
|
||||
create(constructorArgs, privateData) {
|
||||
let obj = Object.create(DOMImplementation.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return obj;
|
||||
},
|
||||
createImpl(constructorArgs, privateData) {
|
||||
let obj = Object.create(DOMImplementation.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return utils.implForWrapper(obj);
|
||||
},
|
||||
_internalSetup(obj) {},
|
||||
setup(obj, constructorArgs, privateData) {
|
||||
if (!privateData) privateData = {};
|
||||
|
||||
privateData.wrapper = obj;
|
||||
|
||||
this._internalSetup(obj);
|
||||
Object.defineProperty(obj, impl, {
|
||||
value: new Impl.implementation(constructorArgs, privateData),
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
obj[impl][utils.wrapperSymbol] = obj;
|
||||
if (Impl.init) {
|
||||
Impl.init(obj[impl], privateData);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
interface: DOMImplementation,
|
||||
expose: {
|
||||
Window: { DOMImplementation }
|
||||
}
|
||||
}; // iface
|
||||
module.exports = iface;
|
||||
|
||||
const Impl = require("../nodes/DOMImplementation-impl.js");
|
141
node_modules/jsdom/lib/jsdom/living/generated/DOMParser.js
generated
vendored
Normal file
141
node_modules/jsdom/lib/jsdom/living/generated/DOMParser.js
generated
vendored
Normal file
|
@ -0,0 +1,141 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const convertSupportedType = require("./SupportedType.js").convert;
|
||||
const impl = utils.implSymbol;
|
||||
|
||||
function DOMParser() {
|
||||
if (new.target === undefined) {
|
||||
throw new TypeError(
|
||||
"Failed to construct 'DOMParser'. Please use the 'new' operator; this constructor " +
|
||||
"cannot be called as a function."
|
||||
);
|
||||
}
|
||||
|
||||
iface.setup(this);
|
||||
}
|
||||
|
||||
Object.defineProperty(DOMParser, "prototype", {
|
||||
value: DOMParser.prototype,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: false
|
||||
});
|
||||
|
||||
DOMParser.prototype.parseFromString = function parseFromString(str, type) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
if (arguments.length < 2) {
|
||||
throw new 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"
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
{
|
||||
let curArg = arguments[1];
|
||||
curArg = convertSupportedType(curArg, {
|
||||
context: "Failed to execute 'parseFromString' on 'DOMParser': parameter 2"
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
return utils.tryWrapperForImpl(this[impl].parseFromString(...args));
|
||||
};
|
||||
|
||||
Object.defineProperty(DOMParser.prototype, Symbol.toStringTag, {
|
||||
value: "DOMParser",
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
const iface = {
|
||||
// When an interface-module that implements this interface as a mixin is loaded, it will append its own `.is()`
|
||||
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
|
||||
// implementing this mixin interface.
|
||||
_mixedIntoPredicates: [],
|
||||
is(obj) {
|
||||
if (obj) {
|
||||
if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(obj)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
isImpl(obj) {
|
||||
if (obj) {
|
||||
if (obj instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const wrapper = utils.wrapperForImpl(obj);
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(wrapper)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (module.exports.is(obj)) {
|
||||
return utils.implForWrapper(obj);
|
||||
}
|
||||
throw new TypeError(`${context} is not of type 'DOMParser'.`);
|
||||
},
|
||||
|
||||
create(constructorArgs, privateData) {
|
||||
let obj = Object.create(DOMParser.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return obj;
|
||||
},
|
||||
createImpl(constructorArgs, privateData) {
|
||||
let obj = Object.create(DOMParser.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return utils.implForWrapper(obj);
|
||||
},
|
||||
_internalSetup(obj) {},
|
||||
setup(obj, constructorArgs, privateData) {
|
||||
if (!privateData) privateData = {};
|
||||
|
||||
privateData.wrapper = obj;
|
||||
|
||||
this._internalSetup(obj);
|
||||
Object.defineProperty(obj, impl, {
|
||||
value: new Impl.implementation(constructorArgs, privateData),
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
obj[impl][utils.wrapperSymbol] = obj;
|
||||
if (Impl.init) {
|
||||
Impl.init(obj[impl], privateData);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
interface: DOMParser,
|
||||
expose: {
|
||||
Window: { DOMParser }
|
||||
}
|
||||
}; // iface
|
||||
module.exports = iface;
|
||||
|
||||
const Impl = require("../domparsing/DOMParser-impl.js");
|
275
node_modules/jsdom/lib/jsdom/living/generated/DOMStringMap.js
generated
vendored
Normal file
275
node_modules/jsdom/lib/jsdom/living/generated/DOMStringMap.js
generated
vendored
Normal file
|
@ -0,0 +1,275 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const impl = utils.implSymbol;
|
||||
|
||||
function DOMStringMap() {
|
||||
throw new TypeError("Illegal constructor");
|
||||
}
|
||||
|
||||
Object.defineProperty(DOMStringMap, "prototype", {
|
||||
value: DOMStringMap.prototype,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: false
|
||||
});
|
||||
|
||||
Object.defineProperty(DOMStringMap.prototype, Symbol.toStringTag, {
|
||||
value: "DOMStringMap",
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
const iface = {
|
||||
// When an interface-module that implements this interface as a mixin is loaded, it will append its own `.is()`
|
||||
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
|
||||
// implementing this mixin interface.
|
||||
_mixedIntoPredicates: [],
|
||||
is(obj) {
|
||||
if (obj) {
|
||||
if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(obj)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
isImpl(obj) {
|
||||
if (obj) {
|
||||
if (obj instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const wrapper = utils.wrapperForImpl(obj);
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(wrapper)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (module.exports.is(obj)) {
|
||||
return utils.implForWrapper(obj);
|
||||
}
|
||||
throw new TypeError(`${context} is not of type 'DOMStringMap'.`);
|
||||
},
|
||||
|
||||
create(constructorArgs, privateData) {
|
||||
let obj = Object.create(DOMStringMap.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return obj;
|
||||
},
|
||||
createImpl(constructorArgs, privateData) {
|
||||
let obj = Object.create(DOMStringMap.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return utils.implForWrapper(obj);
|
||||
},
|
||||
_internalSetup(obj) {},
|
||||
setup(obj, constructorArgs, privateData) {
|
||||
if (!privateData) privateData = {};
|
||||
|
||||
privateData.wrapper = obj;
|
||||
|
||||
this._internalSetup(obj);
|
||||
Object.defineProperty(obj, impl, {
|
||||
value: new Impl.implementation(constructorArgs, privateData),
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
obj = new Proxy(obj, {
|
||||
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[impl][utils.supportedPropertyNames]) {
|
||||
if (!utils.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[impl][utils.namedGet](P);
|
||||
|
||||
if (namedValue !== undefined && !utils.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);
|
||||
}
|
||||
if (target === receiver) {
|
||||
if (typeof P === "string" && !utils.isArrayIndexPropName(P)) {
|
||||
let namedValue = V;
|
||||
|
||||
namedValue = conversions["DOMString"](namedValue, {
|
||||
context: "Failed to set the '" + P + "' property on 'DOMStringMap': The provided value"
|
||||
});
|
||||
|
||||
const creating = !(target[impl][utils.namedGet](P) !== undefined);
|
||||
if (creating) {
|
||||
target[impl][utils.namedSetNew](P, namedValue);
|
||||
} else {
|
||||
target[impl][utils.namedSetExisting](P, namedValue);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
let ownDesc;
|
||||
|
||||
if (ownDesc === undefined) {
|
||||
ownDesc = Reflect.getOwnPropertyDescriptor(target, P);
|
||||
}
|
||||
if (ownDesc === undefined) {
|
||||
const parent = Reflect.getPrototypeOf(target);
|
||||
if (parent !== null) {
|
||||
return Reflect.set(parent, P, V, receiver);
|
||||
}
|
||||
ownDesc = { writable: true, enumerable: true, configurable: true, value: undefined };
|
||||
}
|
||||
if (!ownDesc.writable) {
|
||||
return false;
|
||||
}
|
||||
if (!utils.isObject(receiver)) {
|
||||
return false;
|
||||
}
|
||||
const existingDesc = Reflect.getOwnPropertyDescriptor(receiver, P);
|
||||
let valueDesc;
|
||||
if (existingDesc !== undefined) {
|
||||
if (existingDesc.get || existingDesc.set) {
|
||||
return false;
|
||||
}
|
||||
if (!existingDesc.writable) {
|
||||
return false;
|
||||
}
|
||||
valueDesc = { value: V };
|
||||
} else {
|
||||
valueDesc = { writable: true, enumerable: true, configurable: true, value: V };
|
||||
}
|
||||
return Reflect.defineProperty(receiver, P, valueDesc);
|
||||
},
|
||||
|
||||
defineProperty(target, P, desc) {
|
||||
if (typeof P === "symbol") {
|
||||
return Reflect.defineProperty(target, P, desc);
|
||||
}
|
||||
|
||||
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"
|
||||
});
|
||||
|
||||
const creating = !(target[impl][utils.namedGet](P) !== undefined);
|
||||
if (creating) {
|
||||
target[impl][utils.namedSetNew](P, namedValue);
|
||||
} else {
|
||||
target[impl][utils.namedSetExisting](P, namedValue);
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
deleteProperty(target, P) {
|
||||
if (typeof P === "symbol") {
|
||||
return Reflect.deleteProperty(target, P);
|
||||
}
|
||||
|
||||
if (target[impl][utils.namedGet](P) !== undefined && !utils.hasOwn(target, P)) {
|
||||
target[impl][utils.namedDelete](P);
|
||||
return true;
|
||||
}
|
||||
|
||||
return Reflect.deleteProperty(target, P);
|
||||
},
|
||||
|
||||
preventExtensions() {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
obj[impl][utils.wrapperSymbol] = obj;
|
||||
if (Impl.init) {
|
||||
Impl.init(obj[impl], privateData);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
interface: DOMStringMap,
|
||||
expose: {
|
||||
Window: { DOMStringMap }
|
||||
}
|
||||
}; // iface
|
||||
module.exports = iface;
|
||||
|
||||
const Impl = require("../nodes/DOMStringMap-impl.js");
|
464
node_modules/jsdom/lib/jsdom/living/generated/DOMTokenList.js
generated
vendored
Normal file
464
node_modules/jsdom/lib/jsdom/living/generated/DOMTokenList.js
generated
vendored
Normal file
|
@ -0,0 +1,464 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const impl = utils.implSymbol;
|
||||
|
||||
function DOMTokenList() {
|
||||
throw new TypeError("Illegal constructor");
|
||||
}
|
||||
|
||||
Object.defineProperty(DOMTokenList, "prototype", {
|
||||
value: DOMTokenList.prototype,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: false
|
||||
});
|
||||
|
||||
Object.defineProperty(DOMTokenList.prototype, Symbol.iterator, {
|
||||
writable: true,
|
||||
enumerable: false,
|
||||
configurable: true,
|
||||
value: Array.prototype[Symbol.iterator]
|
||||
});
|
||||
DOMTokenList.prototype.forEach = Array.prototype.forEach;
|
||||
DOMTokenList.prototype.item = function item(index) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
if (arguments.length < 1) {
|
||||
throw new 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"
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
return this[impl].item(...args);
|
||||
};
|
||||
|
||||
DOMTokenList.prototype.contains = function contains(token) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
if (arguments.length < 1) {
|
||||
throw new 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"
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
return this[impl].contains(...args);
|
||||
};
|
||||
|
||||
DOMTokenList.prototype.add = function add() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
const args = [];
|
||||
for (let i = 0; i < arguments.length; i++) {
|
||||
let curArg = arguments[i];
|
||||
curArg = conversions["DOMString"](curArg, {
|
||||
context: "Failed to execute 'add' on 'DOMTokenList': parameter " + (i + 1)
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
return this[impl].add(...args);
|
||||
};
|
||||
|
||||
DOMTokenList.prototype.remove = function remove() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
const args = [];
|
||||
for (let i = 0; i < arguments.length; i++) {
|
||||
let curArg = arguments[i];
|
||||
curArg = conversions["DOMString"](curArg, {
|
||||
context: "Failed to execute 'remove' on 'DOMTokenList': parameter " + (i + 1)
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
return this[impl].remove(...args);
|
||||
};
|
||||
|
||||
DOMTokenList.prototype.toggle = function toggle(token) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
if (arguments.length < 1) {
|
||||
throw new 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" });
|
||||
args.push(curArg);
|
||||
}
|
||||
{
|
||||
let curArg = arguments[1];
|
||||
if (curArg !== undefined) {
|
||||
curArg = conversions["boolean"](curArg, { context: "Failed to execute 'toggle' on 'DOMTokenList': parameter 2" });
|
||||
}
|
||||
args.push(curArg);
|
||||
}
|
||||
return this[impl].toggle(...args);
|
||||
};
|
||||
|
||||
DOMTokenList.prototype.replace = function replace(token, newToken) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
if (arguments.length < 2) {
|
||||
throw new 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"
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
{
|
||||
let curArg = arguments[1];
|
||||
curArg = conversions["DOMString"](curArg, {
|
||||
context: "Failed to execute 'replace' on 'DOMTokenList': parameter 2"
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
return this[impl].replace(...args);
|
||||
};
|
||||
|
||||
DOMTokenList.prototype.supports = function supports(token) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
if (arguments.length < 1) {
|
||||
throw new 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"
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
return this[impl].supports(...args);
|
||||
};
|
||||
|
||||
DOMTokenList.prototype.entries = Array.prototype.entries;
|
||||
DOMTokenList.prototype.keys = Array.prototype.keys;
|
||||
DOMTokenList.prototype.values = Array.prototype[Symbol.iterator];
|
||||
|
||||
Object.defineProperty(DOMTokenList.prototype, "length", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["length"];
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(DOMTokenList.prototype, "value", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["value"];
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["DOMString"](V, {
|
||||
context: "Failed to set the 'value' property on 'DOMTokenList': The provided value"
|
||||
});
|
||||
|
||||
this[impl]["value"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
DOMTokenList.prototype.toString = function toString() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
return this[impl]["value"];
|
||||
};
|
||||
|
||||
Object.defineProperty(DOMTokenList.prototype, Symbol.toStringTag, {
|
||||
value: "DOMTokenList",
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
const iface = {
|
||||
// When an interface-module that implements this interface as a mixin is loaded, it will append its own `.is()`
|
||||
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
|
||||
// implementing this mixin interface.
|
||||
_mixedIntoPredicates: [],
|
||||
is(obj) {
|
||||
if (obj) {
|
||||
if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(obj)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
isImpl(obj) {
|
||||
if (obj) {
|
||||
if (obj instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const wrapper = utils.wrapperForImpl(obj);
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(wrapper)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (module.exports.is(obj)) {
|
||||
return utils.implForWrapper(obj);
|
||||
}
|
||||
throw new TypeError(`${context} is not of type 'DOMTokenList'.`);
|
||||
},
|
||||
|
||||
create(constructorArgs, privateData) {
|
||||
let obj = Object.create(DOMTokenList.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return obj;
|
||||
},
|
||||
createImpl(constructorArgs, privateData) {
|
||||
let obj = Object.create(DOMTokenList.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return utils.implForWrapper(obj);
|
||||
},
|
||||
_internalSetup(obj) {},
|
||||
setup(obj, constructorArgs, privateData) {
|
||||
if (!privateData) privateData = {};
|
||||
|
||||
privateData.wrapper = obj;
|
||||
|
||||
this._internalSetup(obj);
|
||||
Object.defineProperty(obj, impl, {
|
||||
value: new Impl.implementation(constructorArgs, privateData),
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
obj = new Proxy(obj, {
|
||||
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[impl][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[impl].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);
|
||||
}
|
||||
if (target === receiver) {
|
||||
utils.isArrayIndexPropName(P);
|
||||
}
|
||||
let ownDesc;
|
||||
|
||||
if (utils.isArrayIndexPropName(P)) {
|
||||
const index = P >>> 0;
|
||||
const indexedValue = target[impl].item(index);
|
||||
if (indexedValue !== null) {
|
||||
ownDesc = {
|
||||
writable: false,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
value: utils.tryWrapperForImpl(indexedValue)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
if (ownDesc === undefined) {
|
||||
ownDesc = Reflect.getOwnPropertyDescriptor(target, P);
|
||||
}
|
||||
if (ownDesc === undefined) {
|
||||
const parent = Reflect.getPrototypeOf(target);
|
||||
if (parent !== null) {
|
||||
return Reflect.set(parent, P, V, receiver);
|
||||
}
|
||||
ownDesc = { writable: true, enumerable: true, configurable: true, value: undefined };
|
||||
}
|
||||
if (!ownDesc.writable) {
|
||||
return false;
|
||||
}
|
||||
if (!utils.isObject(receiver)) {
|
||||
return false;
|
||||
}
|
||||
const existingDesc = Reflect.getOwnPropertyDescriptor(receiver, P);
|
||||
let valueDesc;
|
||||
if (existingDesc !== undefined) {
|
||||
if (existingDesc.get || existingDesc.set) {
|
||||
return false;
|
||||
}
|
||||
if (!existingDesc.writable) {
|
||||
return false;
|
||||
}
|
||||
valueDesc = { value: V };
|
||||
} else {
|
||||
valueDesc = { writable: true, enumerable: true, configurable: true, value: V };
|
||||
}
|
||||
return Reflect.defineProperty(receiver, P, valueDesc);
|
||||
},
|
||||
|
||||
defineProperty(target, P, desc) {
|
||||
if (typeof P === "symbol") {
|
||||
return Reflect.defineProperty(target, P, desc);
|
||||
}
|
||||
|
||||
if (utils.isArrayIndexPropName(P)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return Reflect.defineProperty(target, P, desc);
|
||||
},
|
||||
|
||||
deleteProperty(target, P) {
|
||||
if (typeof P === "symbol") {
|
||||
return Reflect.deleteProperty(target, P);
|
||||
}
|
||||
|
||||
if (utils.isArrayIndexPropName(P)) {
|
||||
const index = P >>> 0;
|
||||
return !(target[impl].item(index) !== null);
|
||||
}
|
||||
|
||||
return Reflect.deleteProperty(target, P);
|
||||
},
|
||||
|
||||
preventExtensions() {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
obj[impl][utils.wrapperSymbol] = obj;
|
||||
if (Impl.init) {
|
||||
Impl.init(obj[impl], privateData);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
interface: DOMTokenList,
|
||||
expose: {
|
||||
Window: { DOMTokenList }
|
||||
}
|
||||
}; // iface
|
||||
module.exports = iface;
|
||||
|
||||
const Impl = require("../nodes/DOMTokenList-impl.js");
|
2826
node_modules/jsdom/lib/jsdom/living/generated/Document.js
generated
vendored
Normal file
2826
node_modules/jsdom/lib/jsdom/living/generated/Document.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
284
node_modules/jsdom/lib/jsdom/living/generated/DocumentFragment.js
generated
vendored
Normal file
284
node_modules/jsdom/lib/jsdom/living/generated/DocumentFragment.js
generated
vendored
Normal file
|
@ -0,0 +1,284 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const isNode = require("./Node.js").is;
|
||||
const impl = utils.implSymbol;
|
||||
const Node = require("./Node.js");
|
||||
const NonElementParentNode = require("./NonElementParentNode.js");
|
||||
const ParentNode = require("./ParentNode.js");
|
||||
|
||||
function DocumentFragment() {
|
||||
if (new.target === undefined) {
|
||||
throw new TypeError(
|
||||
"Failed to construct 'DocumentFragment'. Please use the 'new' operator; this constructor " +
|
||||
"cannot be called as a function."
|
||||
);
|
||||
}
|
||||
|
||||
iface.setup(this);
|
||||
}
|
||||
|
||||
Object.setPrototypeOf(DocumentFragment.prototype, Node.interface.prototype);
|
||||
Object.setPrototypeOf(DocumentFragment, Node.interface);
|
||||
|
||||
Object.defineProperty(DocumentFragment, "prototype", {
|
||||
value: DocumentFragment.prototype,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: false
|
||||
});
|
||||
|
||||
DocumentFragment.prototype.getElementById = function getElementById(elementId) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
if (arguments.length < 1) {
|
||||
throw new 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"
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
return utils.tryWrapperForImpl(this[impl].getElementById(...args));
|
||||
};
|
||||
|
||||
DocumentFragment.prototype.prepend = function prepend() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
const args = [];
|
||||
for (let i = 0; i < arguments.length; i++) {
|
||||
let curArg = arguments[i];
|
||||
if (isNode(curArg)) {
|
||||
curArg = utils.implForWrapper(curArg);
|
||||
} else {
|
||||
curArg = conversions["DOMString"](curArg, {
|
||||
context: "Failed to execute 'prepend' on 'DocumentFragment': parameter " + (i + 1)
|
||||
});
|
||||
}
|
||||
args.push(curArg);
|
||||
}
|
||||
return this[impl].prepend(...args);
|
||||
};
|
||||
|
||||
DocumentFragment.prototype.append = function append() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
const args = [];
|
||||
for (let i = 0; i < arguments.length; i++) {
|
||||
let curArg = arguments[i];
|
||||
if (isNode(curArg)) {
|
||||
curArg = utils.implForWrapper(curArg);
|
||||
} else {
|
||||
curArg = conversions["DOMString"](curArg, {
|
||||
context: "Failed to execute 'append' on 'DocumentFragment': parameter " + (i + 1)
|
||||
});
|
||||
}
|
||||
args.push(curArg);
|
||||
}
|
||||
return this[impl].append(...args);
|
||||
};
|
||||
|
||||
DocumentFragment.prototype.querySelector = function querySelector(selectors) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
if (arguments.length < 1) {
|
||||
throw new 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"
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
return utils.tryWrapperForImpl(this[impl].querySelector(...args));
|
||||
};
|
||||
|
||||
DocumentFragment.prototype.querySelectorAll = function querySelectorAll(selectors) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
if (arguments.length < 1) {
|
||||
throw new 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"
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
return utils.tryWrapperForImpl(this[impl].querySelectorAll(...args));
|
||||
};
|
||||
|
||||
Object.defineProperty(DocumentFragment.prototype, "children", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return utils.getSameObject(this, "children", () => {
|
||||
return utils.tryWrapperForImpl(this[impl]["children"]);
|
||||
});
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(DocumentFragment.prototype, "firstElementChild", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return utils.tryWrapperForImpl(this[impl]["firstElementChild"]);
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(DocumentFragment.prototype, "lastElementChild", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return utils.tryWrapperForImpl(this[impl]["lastElementChild"]);
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(DocumentFragment.prototype, "childElementCount", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["childElementCount"];
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(DocumentFragment.prototype, Symbol.toStringTag, {
|
||||
value: "DocumentFragment",
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
const iface = {
|
||||
// When an interface-module that implements this interface as a mixin is loaded, it will append its own `.is()`
|
||||
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
|
||||
// implementing this mixin interface.
|
||||
_mixedIntoPredicates: [],
|
||||
is(obj) {
|
||||
if (obj) {
|
||||
if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(obj)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
isImpl(obj) {
|
||||
if (obj) {
|
||||
if (obj instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const wrapper = utils.wrapperForImpl(obj);
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(wrapper)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (module.exports.is(obj)) {
|
||||
return utils.implForWrapper(obj);
|
||||
}
|
||||
throw new TypeError(`${context} is not of type 'DocumentFragment'.`);
|
||||
},
|
||||
|
||||
create(constructorArgs, privateData) {
|
||||
let obj = Object.create(DocumentFragment.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return obj;
|
||||
},
|
||||
createImpl(constructorArgs, privateData) {
|
||||
let obj = Object.create(DocumentFragment.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return utils.implForWrapper(obj);
|
||||
},
|
||||
_internalSetup(obj) {
|
||||
Node._internalSetup(obj);
|
||||
},
|
||||
setup(obj, constructorArgs, privateData) {
|
||||
if (!privateData) privateData = {};
|
||||
|
||||
privateData.wrapper = obj;
|
||||
|
||||
this._internalSetup(obj);
|
||||
Object.defineProperty(obj, impl, {
|
||||
value: new Impl.implementation(constructorArgs, privateData),
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
obj[impl][utils.wrapperSymbol] = obj;
|
||||
if (Impl.init) {
|
||||
Impl.init(obj[impl], privateData);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
interface: DocumentFragment,
|
||||
expose: {
|
||||
Window: { DocumentFragment }
|
||||
}
|
||||
}; // iface
|
||||
module.exports = iface;
|
||||
|
||||
NonElementParentNode._mixedIntoPredicates.push(module.exports.is);
|
||||
|
||||
ParentNode._mixedIntoPredicates.push(module.exports.is);
|
||||
|
||||
const Impl = require("../nodes/DocumentFragment-impl.js");
|
13
node_modules/jsdom/lib/jsdom/living/generated/DocumentReadyState.js
generated
vendored
Normal file
13
node_modules/jsdom/lib/jsdom/living/generated/DocumentReadyState.js
generated
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
"use strict";
|
||||
|
||||
const enumerationValues = new Set(["loading", "interactive", "complete"]);
|
||||
module.exports = {
|
||||
enumerationValues,
|
||||
convert(value, { context = "The provided value" } = {}) {
|
||||
const string = `${value}`;
|
||||
if (!enumerationValues.has(value)) {
|
||||
throw new TypeError(`${context} '${value}' is not a valid enumeration value for DocumentReadyState`);
|
||||
}
|
||||
return string;
|
||||
}
|
||||
};
|
217
node_modules/jsdom/lib/jsdom/living/generated/DocumentType.js
generated
vendored
Normal file
217
node_modules/jsdom/lib/jsdom/living/generated/DocumentType.js
generated
vendored
Normal file
|
@ -0,0 +1,217 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const isNode = require("./Node.js").is;
|
||||
const impl = utils.implSymbol;
|
||||
const Node = require("./Node.js");
|
||||
const ChildNode = require("./ChildNode.js");
|
||||
|
||||
function DocumentType() {
|
||||
throw new TypeError("Illegal constructor");
|
||||
}
|
||||
|
||||
Object.setPrototypeOf(DocumentType.prototype, Node.interface.prototype);
|
||||
Object.setPrototypeOf(DocumentType, Node.interface);
|
||||
|
||||
Object.defineProperty(DocumentType, "prototype", {
|
||||
value: DocumentType.prototype,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: false
|
||||
});
|
||||
|
||||
DocumentType.prototype.before = function before() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
const args = [];
|
||||
for (let i = 0; i < arguments.length; i++) {
|
||||
let curArg = arguments[i];
|
||||
if (isNode(curArg)) {
|
||||
curArg = utils.implForWrapper(curArg);
|
||||
} else {
|
||||
curArg = conversions["DOMString"](curArg, {
|
||||
context: "Failed to execute 'before' on 'DocumentType': parameter " + (i + 1)
|
||||
});
|
||||
}
|
||||
args.push(curArg);
|
||||
}
|
||||
return this[impl].before(...args);
|
||||
};
|
||||
|
||||
DocumentType.prototype.after = function after() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
const args = [];
|
||||
for (let i = 0; i < arguments.length; i++) {
|
||||
let curArg = arguments[i];
|
||||
if (isNode(curArg)) {
|
||||
curArg = utils.implForWrapper(curArg);
|
||||
} else {
|
||||
curArg = conversions["DOMString"](curArg, {
|
||||
context: "Failed to execute 'after' on 'DocumentType': parameter " + (i + 1)
|
||||
});
|
||||
}
|
||||
args.push(curArg);
|
||||
}
|
||||
return this[impl].after(...args);
|
||||
};
|
||||
|
||||
DocumentType.prototype.replaceWith = function replaceWith() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
const args = [];
|
||||
for (let i = 0; i < arguments.length; i++) {
|
||||
let curArg = arguments[i];
|
||||
if (isNode(curArg)) {
|
||||
curArg = utils.implForWrapper(curArg);
|
||||
} else {
|
||||
curArg = conversions["DOMString"](curArg, {
|
||||
context: "Failed to execute 'replaceWith' on 'DocumentType': parameter " + (i + 1)
|
||||
});
|
||||
}
|
||||
args.push(curArg);
|
||||
}
|
||||
return this[impl].replaceWith(...args);
|
||||
};
|
||||
|
||||
DocumentType.prototype.remove = function remove() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl].remove();
|
||||
};
|
||||
|
||||
Object.defineProperty(DocumentType.prototype, "name", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["name"];
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(DocumentType.prototype, "publicId", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["publicId"];
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(DocumentType.prototype, "systemId", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["systemId"];
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(DocumentType.prototype, Symbol.toStringTag, {
|
||||
value: "DocumentType",
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
const iface = {
|
||||
// When an interface-module that implements this interface as a mixin is loaded, it will append its own `.is()`
|
||||
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
|
||||
// implementing this mixin interface.
|
||||
_mixedIntoPredicates: [],
|
||||
is(obj) {
|
||||
if (obj) {
|
||||
if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(obj)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
isImpl(obj) {
|
||||
if (obj) {
|
||||
if (obj instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const wrapper = utils.wrapperForImpl(obj);
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(wrapper)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (module.exports.is(obj)) {
|
||||
return utils.implForWrapper(obj);
|
||||
}
|
||||
throw new TypeError(`${context} is not of type 'DocumentType'.`);
|
||||
},
|
||||
|
||||
create(constructorArgs, privateData) {
|
||||
let obj = Object.create(DocumentType.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return obj;
|
||||
},
|
||||
createImpl(constructorArgs, privateData) {
|
||||
let obj = Object.create(DocumentType.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return utils.implForWrapper(obj);
|
||||
},
|
||||
_internalSetup(obj) {
|
||||
Node._internalSetup(obj);
|
||||
},
|
||||
setup(obj, constructorArgs, privateData) {
|
||||
if (!privateData) privateData = {};
|
||||
|
||||
privateData.wrapper = obj;
|
||||
|
||||
this._internalSetup(obj);
|
||||
Object.defineProperty(obj, impl, {
|
||||
value: new Impl.implementation(constructorArgs, privateData),
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
obj[impl][utils.wrapperSymbol] = obj;
|
||||
if (Impl.init) {
|
||||
Impl.init(obj[impl], privateData);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
interface: DocumentType,
|
||||
expose: {
|
||||
Window: { DocumentType }
|
||||
}
|
||||
}; // iface
|
||||
module.exports = iface;
|
||||
|
||||
ChildNode._mixedIntoPredicates.push(module.exports.is);
|
||||
|
||||
const Impl = require("../nodes/DocumentType-impl.js");
|
1226
node_modules/jsdom/lib/jsdom/living/generated/Element.js
generated
vendored
Normal file
1226
node_modules/jsdom/lib/jsdom/living/generated/Element.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
124
node_modules/jsdom/lib/jsdom/living/generated/ElementCSSInlineStyle.js
generated
vendored
Normal file
124
node_modules/jsdom/lib/jsdom/living/generated/ElementCSSInlineStyle.js
generated
vendored
Normal file
|
@ -0,0 +1,124 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const impl = utils.implSymbol;
|
||||
|
||||
function ElementCSSInlineStyle() {
|
||||
throw new TypeError("Illegal constructor");
|
||||
}
|
||||
|
||||
Object.defineProperty(ElementCSSInlineStyle, "prototype", {
|
||||
value: ElementCSSInlineStyle.prototype,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: false
|
||||
});
|
||||
|
||||
Object.defineProperty(ElementCSSInlineStyle.prototype, "style", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return utils.getSameObject(this, "style", () => {
|
||||
return utils.tryWrapperForImpl(this[impl]["style"]);
|
||||
});
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
this.style.cssText = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(ElementCSSInlineStyle.prototype, Symbol.toStringTag, {
|
||||
value: "ElementCSSInlineStyle",
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
const iface = {
|
||||
// When an interface-module that implements this interface as a mixin is loaded, it will append its own `.is()`
|
||||
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
|
||||
// implementing this mixin interface.
|
||||
_mixedIntoPredicates: [],
|
||||
is(obj) {
|
||||
if (obj) {
|
||||
if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(obj)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
isImpl(obj) {
|
||||
if (obj) {
|
||||
if (obj instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const wrapper = utils.wrapperForImpl(obj);
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(wrapper)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (module.exports.is(obj)) {
|
||||
return utils.implForWrapper(obj);
|
||||
}
|
||||
throw new TypeError(`${context} is not of type 'ElementCSSInlineStyle'.`);
|
||||
},
|
||||
|
||||
create(constructorArgs, privateData) {
|
||||
let obj = Object.create(ElementCSSInlineStyle.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return obj;
|
||||
},
|
||||
createImpl(constructorArgs, privateData) {
|
||||
let obj = Object.create(ElementCSSInlineStyle.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return utils.implForWrapper(obj);
|
||||
},
|
||||
_internalSetup(obj) {},
|
||||
setup(obj, constructorArgs, privateData) {
|
||||
if (!privateData) privateData = {};
|
||||
|
||||
privateData.wrapper = obj;
|
||||
|
||||
this._internalSetup(obj);
|
||||
Object.defineProperty(obj, impl, {
|
||||
value: new Impl.implementation(constructorArgs, privateData),
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
obj[impl][utils.wrapperSymbol] = obj;
|
||||
if (Impl.init) {
|
||||
Impl.init(obj[impl], privateData);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
interface: ElementCSSInlineStyle,
|
||||
expose: {}
|
||||
}; // iface
|
||||
module.exports = iface;
|
||||
|
||||
const Impl = require("../nodes/ElementCSSInlineStyle-impl.js");
|
101
node_modules/jsdom/lib/jsdom/living/generated/ElementContentEditable.js
generated
vendored
Normal file
101
node_modules/jsdom/lib/jsdom/living/generated/ElementContentEditable.js
generated
vendored
Normal file
|
@ -0,0 +1,101 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const impl = utils.implSymbol;
|
||||
|
||||
function ElementContentEditable() {
|
||||
throw new TypeError("Illegal constructor");
|
||||
}
|
||||
|
||||
Object.defineProperty(ElementContentEditable, "prototype", {
|
||||
value: ElementContentEditable.prototype,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: false
|
||||
});
|
||||
|
||||
Object.defineProperty(ElementContentEditable.prototype, Symbol.toStringTag, {
|
||||
value: "ElementContentEditable",
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
const iface = {
|
||||
// When an interface-module that implements this interface as a mixin is loaded, it will append its own `.is()`
|
||||
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
|
||||
// implementing this mixin interface.
|
||||
_mixedIntoPredicates: [],
|
||||
is(obj) {
|
||||
if (obj) {
|
||||
if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(obj)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
isImpl(obj) {
|
||||
if (obj) {
|
||||
if (obj instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const wrapper = utils.wrapperForImpl(obj);
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(wrapper)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (module.exports.is(obj)) {
|
||||
return utils.implForWrapper(obj);
|
||||
}
|
||||
throw new TypeError(`${context} is not of type 'ElementContentEditable'.`);
|
||||
},
|
||||
|
||||
create(constructorArgs, privateData) {
|
||||
let obj = Object.create(ElementContentEditable.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return obj;
|
||||
},
|
||||
createImpl(constructorArgs, privateData) {
|
||||
let obj = Object.create(ElementContentEditable.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return utils.implForWrapper(obj);
|
||||
},
|
||||
_internalSetup(obj) {},
|
||||
setup(obj, constructorArgs, privateData) {
|
||||
if (!privateData) privateData = {};
|
||||
|
||||
privateData.wrapper = obj;
|
||||
|
||||
this._internalSetup(obj);
|
||||
Object.defineProperty(obj, impl, {
|
||||
value: new Impl.implementation(constructorArgs, privateData),
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
obj[impl][utils.wrapperSymbol] = obj;
|
||||
if (Impl.init) {
|
||||
Impl.init(obj[impl], privateData);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
interface: ElementContentEditable,
|
||||
expose: {}
|
||||
}; // iface
|
||||
module.exports = iface;
|
||||
|
||||
const Impl = require("../nodes/ElementContentEditable-impl.js");
|
28
node_modules/jsdom/lib/jsdom/living/generated/ElementCreationOptions.js
generated
vendored
Normal file
28
node_modules/jsdom/lib/jsdom/living/generated/ElementCreationOptions.js
generated
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
module.exports = {
|
||||
convertInherit(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" });
|
||||
|
||||
ret[key] = value;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") {
|
||||
throw new TypeError(`${context} is not an object.`);
|
||||
}
|
||||
|
||||
const ret = Object.create(null);
|
||||
module.exports.convertInherit(obj, ret, { context });
|
||||
return ret;
|
||||
}
|
||||
};
|
13
node_modules/jsdom/lib/jsdom/living/generated/EndingType.js
generated
vendored
Normal file
13
node_modules/jsdom/lib/jsdom/living/generated/EndingType.js
generated
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
"use strict";
|
||||
|
||||
const enumerationValues = new Set(["transparent", "native"]);
|
||||
module.exports = {
|
||||
enumerationValues,
|
||||
convert(value, { context = "The provided value" } = {}) {
|
||||
const string = `${value}`;
|
||||
if (!enumerationValues.has(value)) {
|
||||
throw new TypeError(`${context} '${value}' is not a valid enumeration value for EndingType`);
|
||||
}
|
||||
return string;
|
||||
}
|
||||
};
|
200
node_modules/jsdom/lib/jsdom/living/generated/ErrorEvent.js
generated
vendored
Normal file
200
node_modules/jsdom/lib/jsdom/living/generated/ErrorEvent.js
generated
vendored
Normal file
|
@ -0,0 +1,200 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const convertErrorEventInit = require("./ErrorEventInit.js").convert;
|
||||
const impl = utils.implSymbol;
|
||||
const Event = require("./Event.js");
|
||||
|
||||
function ErrorEvent(type) {
|
||||
if (new.target === undefined) {
|
||||
throw new TypeError(
|
||||
"Failed to construct 'ErrorEvent'. Please use the 'new' operator; this constructor " +
|
||||
"cannot be called as a function."
|
||||
);
|
||||
}
|
||||
|
||||
if (arguments.length < 1) {
|
||||
throw new 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" });
|
||||
args.push(curArg);
|
||||
}
|
||||
{
|
||||
let curArg = arguments[1];
|
||||
curArg = convertErrorEventInit(curArg, { context: "Failed to construct 'ErrorEvent': parameter 2" });
|
||||
args.push(curArg);
|
||||
}
|
||||
|
||||
iface.setup(this, args);
|
||||
}
|
||||
|
||||
Object.setPrototypeOf(ErrorEvent.prototype, Event.interface.prototype);
|
||||
Object.setPrototypeOf(ErrorEvent, Event.interface);
|
||||
|
||||
Object.defineProperty(ErrorEvent, "prototype", {
|
||||
value: ErrorEvent.prototype,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: false
|
||||
});
|
||||
|
||||
Object.defineProperty(ErrorEvent.prototype, "message", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["message"];
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(ErrorEvent.prototype, "filename", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["filename"];
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(ErrorEvent.prototype, "lineno", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["lineno"];
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(ErrorEvent.prototype, "colno", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["colno"];
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(ErrorEvent.prototype, "error", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["error"];
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(ErrorEvent.prototype, Symbol.toStringTag, {
|
||||
value: "ErrorEvent",
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
const iface = {
|
||||
// When an interface-module that implements this interface as a mixin is loaded, it will append its own `.is()`
|
||||
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
|
||||
// implementing this mixin interface.
|
||||
_mixedIntoPredicates: [],
|
||||
is(obj) {
|
||||
if (obj) {
|
||||
if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(obj)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
isImpl(obj) {
|
||||
if (obj) {
|
||||
if (obj instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const wrapper = utils.wrapperForImpl(obj);
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(wrapper)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (module.exports.is(obj)) {
|
||||
return utils.implForWrapper(obj);
|
||||
}
|
||||
throw new TypeError(`${context} is not of type 'ErrorEvent'.`);
|
||||
},
|
||||
|
||||
create(constructorArgs, privateData) {
|
||||
let obj = Object.create(ErrorEvent.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return obj;
|
||||
},
|
||||
createImpl(constructorArgs, privateData) {
|
||||
let obj = Object.create(ErrorEvent.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return utils.implForWrapper(obj);
|
||||
},
|
||||
_internalSetup(obj) {
|
||||
Event._internalSetup(obj);
|
||||
},
|
||||
setup(obj, constructorArgs, privateData) {
|
||||
if (!privateData) privateData = {};
|
||||
|
||||
privateData.wrapper = obj;
|
||||
|
||||
this._internalSetup(obj);
|
||||
Object.defineProperty(obj, impl, {
|
||||
value: new Impl.implementation(constructorArgs, privateData),
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
obj[impl][utils.wrapperSymbol] = obj;
|
||||
if (Impl.init) {
|
||||
Impl.init(obj[impl], privateData);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
interface: ErrorEvent,
|
||||
expose: {
|
||||
Window: { ErrorEvent },
|
||||
Worker: { ErrorEvent }
|
||||
}
|
||||
}; // iface
|
||||
module.exports = iface;
|
||||
|
||||
const Impl = require("../events/ErrorEvent-impl.js");
|
82
node_modules/jsdom/lib/jsdom/living/generated/ErrorEventInit.js
generated
vendored
Normal file
82
node_modules/jsdom/lib/jsdom/living/generated/ErrorEventInit.js
generated
vendored
Normal file
|
@ -0,0 +1,82 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const EventInit = require("./EventInit.js");
|
||||
|
||||
module.exports = {
|
||||
convertInherit(obj, ret, { context = "The provided value" } = {}) {
|
||||
EventInit.convertInherit(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" });
|
||||
|
||||
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" });
|
||||
|
||||
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" });
|
||||
|
||||
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" });
|
||||
|
||||
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" });
|
||||
|
||||
ret[key] = value;
|
||||
} else {
|
||||
ret[key] = "";
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") {
|
||||
throw new TypeError(`${context} is not an object.`);
|
||||
}
|
||||
|
||||
const ret = Object.create(null);
|
||||
module.exports.convertInherit(obj, ret, { context });
|
||||
return ret;
|
||||
}
|
||||
};
|
405
node_modules/jsdom/lib/jsdom/living/generated/Event.js
generated
vendored
Normal file
405
node_modules/jsdom/lib/jsdom/living/generated/Event.js
generated
vendored
Normal file
|
@ -0,0 +1,405 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const convertEventInit = require("./EventInit.js").convert;
|
||||
const impl = utils.implSymbol;
|
||||
|
||||
function Event(type) {
|
||||
if (new.target === undefined) {
|
||||
throw new TypeError(
|
||||
"Failed to construct 'Event'. Please use the 'new' operator; this constructor " +
|
||||
"cannot be called as a function."
|
||||
);
|
||||
}
|
||||
|
||||
if (arguments.length < 1) {
|
||||
throw new 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" });
|
||||
args.push(curArg);
|
||||
}
|
||||
{
|
||||
let curArg = arguments[1];
|
||||
curArg = convertEventInit(curArg, { context: "Failed to construct 'Event': parameter 2" });
|
||||
args.push(curArg);
|
||||
}
|
||||
|
||||
iface.setup(this, args);
|
||||
}
|
||||
|
||||
Object.defineProperty(Event, "prototype", {
|
||||
value: Event.prototype,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: false
|
||||
});
|
||||
|
||||
Event.prototype.stopPropagation = function stopPropagation() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl].stopPropagation();
|
||||
};
|
||||
|
||||
Event.prototype.stopImmediatePropagation = function stopImmediatePropagation() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl].stopImmediatePropagation();
|
||||
};
|
||||
|
||||
Event.prototype.preventDefault = function preventDefault() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl].preventDefault();
|
||||
};
|
||||
|
||||
Event.prototype.initEvent = function initEvent(type) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
if (arguments.length < 1) {
|
||||
throw new 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" });
|
||||
args.push(curArg);
|
||||
}
|
||||
{
|
||||
let curArg = arguments[1];
|
||||
if (curArg !== undefined) {
|
||||
curArg = conversions["boolean"](curArg, { context: "Failed to execute 'initEvent' on 'Event': parameter 2" });
|
||||
} 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" });
|
||||
} else {
|
||||
curArg = false;
|
||||
}
|
||||
args.push(curArg);
|
||||
}
|
||||
return this[impl].initEvent(...args);
|
||||
};
|
||||
|
||||
Object.defineProperty(Event.prototype, "type", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["type"];
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(Event.prototype, "target", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return utils.tryWrapperForImpl(this[impl]["target"]);
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(Event.prototype, "srcElement", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return utils.tryWrapperForImpl(this[impl]["srcElement"]);
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(Event.prototype, "currentTarget", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return utils.tryWrapperForImpl(this[impl]["currentTarget"]);
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(Event.prototype, "eventPhase", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["eventPhase"];
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(Event.prototype, "cancelBubble", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["cancelBubble"];
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["boolean"](V, {
|
||||
context: "Failed to set the 'cancelBubble' property on 'Event': The provided value"
|
||||
});
|
||||
|
||||
this[impl]["cancelBubble"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(Event.prototype, "bubbles", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["bubbles"];
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(Event.prototype, "cancelable", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["cancelable"];
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(Event.prototype, "returnValue", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["returnValue"];
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["boolean"](V, {
|
||||
context: "Failed to set the 'returnValue' property on 'Event': The provided value"
|
||||
});
|
||||
|
||||
this[impl]["returnValue"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(Event.prototype, "defaultPrevented", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["defaultPrevented"];
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(Event.prototype, "timeStamp", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["timeStamp"];
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(Event, "NONE", {
|
||||
value: 0,
|
||||
enumerable: true
|
||||
});
|
||||
Object.defineProperty(Event.prototype, "NONE", {
|
||||
value: 0,
|
||||
enumerable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(Event, "CAPTURING_PHASE", {
|
||||
value: 1,
|
||||
enumerable: true
|
||||
});
|
||||
Object.defineProperty(Event.prototype, "CAPTURING_PHASE", {
|
||||
value: 1,
|
||||
enumerable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(Event, "AT_TARGET", {
|
||||
value: 2,
|
||||
enumerable: true
|
||||
});
|
||||
Object.defineProperty(Event.prototype, "AT_TARGET", {
|
||||
value: 2,
|
||||
enumerable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(Event, "BUBBLING_PHASE", {
|
||||
value: 3,
|
||||
enumerable: true
|
||||
});
|
||||
Object.defineProperty(Event.prototype, "BUBBLING_PHASE", {
|
||||
value: 3,
|
||||
enumerable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(Event.prototype, Symbol.toStringTag, {
|
||||
value: "Event",
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
const iface = {
|
||||
// When an interface-module that implements this interface as a mixin is loaded, it will append its own `.is()`
|
||||
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
|
||||
// implementing this mixin interface.
|
||||
_mixedIntoPredicates: [],
|
||||
is(obj) {
|
||||
if (obj) {
|
||||
if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(obj)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
isImpl(obj) {
|
||||
if (obj) {
|
||||
if (obj instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const wrapper = utils.wrapperForImpl(obj);
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(wrapper)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (module.exports.is(obj)) {
|
||||
return utils.implForWrapper(obj);
|
||||
}
|
||||
throw new TypeError(`${context} is not of type 'Event'.`);
|
||||
},
|
||||
|
||||
create(constructorArgs, privateData) {
|
||||
let obj = Object.create(Event.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return obj;
|
||||
},
|
||||
createImpl(constructorArgs, privateData) {
|
||||
let obj = Object.create(Event.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return utils.implForWrapper(obj);
|
||||
},
|
||||
_internalSetup(obj) {
|
||||
Object.defineProperty(obj, "isTrusted", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return obj[impl]["isTrusted"];
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: false
|
||||
});
|
||||
},
|
||||
setup(obj, constructorArgs, privateData) {
|
||||
if (!privateData) privateData = {};
|
||||
|
||||
privateData.wrapper = obj;
|
||||
|
||||
this._internalSetup(obj);
|
||||
Object.defineProperty(obj, impl, {
|
||||
value: new Impl.implementation(constructorArgs, privateData),
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
obj[impl][utils.wrapperSymbol] = obj;
|
||||
if (Impl.init) {
|
||||
Impl.init(obj[impl], privateData);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
interface: Event,
|
||||
expose: {
|
||||
Window: { Event },
|
||||
Worker: { Event },
|
||||
AudioWorklet: { Event }
|
||||
}
|
||||
}; // iface
|
||||
module.exports = iface;
|
||||
|
||||
const Impl = require("../events/Event-impl.js");
|
42
node_modules/jsdom/lib/jsdom/living/generated/EventInit.js
generated
vendored
Normal file
42
node_modules/jsdom/lib/jsdom/living/generated/EventInit.js
generated
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
module.exports = {
|
||||
convertInherit(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" });
|
||||
|
||||
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" });
|
||||
|
||||
ret[key] = value;
|
||||
} else {
|
||||
ret[key] = false;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") {
|
||||
throw new TypeError(`${context} is not an object.`);
|
||||
}
|
||||
|
||||
const ret = Object.create(null);
|
||||
module.exports.convertInherit(obj, ret, { context });
|
||||
return ret;
|
||||
}
|
||||
};
|
30
node_modules/jsdom/lib/jsdom/living/generated/EventListenerOptions.js
generated
vendored
Normal file
30
node_modules/jsdom/lib/jsdom/living/generated/EventListenerOptions.js
generated
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
module.exports = {
|
||||
convertInherit(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" });
|
||||
|
||||
ret[key] = value;
|
||||
} else {
|
||||
ret[key] = false;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") {
|
||||
throw new TypeError(`${context} is not an object.`);
|
||||
}
|
||||
|
||||
const ret = Object.create(null);
|
||||
module.exports.convertInherit(obj, ret, { context });
|
||||
return ret;
|
||||
}
|
||||
};
|
190
node_modules/jsdom/lib/jsdom/living/generated/EventModifierInit.js
generated
vendored
Normal file
190
node_modules/jsdom/lib/jsdom/living/generated/EventModifierInit.js
generated
vendored
Normal file
|
@ -0,0 +1,190 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const UIEventInit = require("./UIEventInit.js");
|
||||
|
||||
module.exports = {
|
||||
convertInherit(obj, ret, { context = "The provided value" } = {}) {
|
||||
UIEventInit.convertInherit(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" });
|
||||
|
||||
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" });
|
||||
|
||||
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" });
|
||||
|
||||
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" });
|
||||
|
||||
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" });
|
||||
|
||||
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" });
|
||||
|
||||
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" });
|
||||
|
||||
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" });
|
||||
|
||||
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" });
|
||||
|
||||
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" });
|
||||
|
||||
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" });
|
||||
|
||||
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" });
|
||||
|
||||
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" });
|
||||
|
||||
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" });
|
||||
|
||||
ret[key] = value;
|
||||
} else {
|
||||
ret[key] = false;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") {
|
||||
throw new TypeError(`${context} is not an object.`);
|
||||
}
|
||||
|
||||
const ret = Object.create(null);
|
||||
module.exports.convertInherit(obj, ret, { context });
|
||||
return ret;
|
||||
}
|
||||
};
|
246
node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js
generated
vendored
Normal file
246
node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js
generated
vendored
Normal file
|
@ -0,0 +1,246 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const convertAddEventListenerOptions = require("./AddEventListenerOptions.js").convert;
|
||||
const convertEventListenerOptions = require("./EventListenerOptions.js").convert;
|
||||
const convertEvent = require("./Event.js").convert;
|
||||
const impl = utils.implSymbol;
|
||||
|
||||
function EventTarget() {
|
||||
if (new.target === undefined) {
|
||||
throw new TypeError(
|
||||
"Failed to construct 'EventTarget'. Please use the 'new' operator; this constructor " +
|
||||
"cannot be called as a function."
|
||||
);
|
||||
}
|
||||
|
||||
iface.setup(this);
|
||||
}
|
||||
|
||||
Object.defineProperty(EventTarget, "prototype", {
|
||||
value: EventTarget.prototype,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: false
|
||||
});
|
||||
|
||||
EventTarget.prototype.addEventListener = function addEventListener(type, callback) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
if (arguments.length < 2) {
|
||||
throw new 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"
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
{
|
||||
let curArg = arguments[1];
|
||||
if (curArg === null || curArg === undefined) {
|
||||
curArg = null;
|
||||
} else {
|
||||
curArg = utils.tryImplForWrapper(curArg);
|
||||
}
|
||||
args.push(curArg);
|
||||
}
|
||||
{
|
||||
let curArg = arguments[2];
|
||||
if (curArg !== undefined) {
|
||||
if (curArg === null || curArg === undefined) {
|
||||
curArg = convertAddEventListenerOptions(curArg, {
|
||||
context: "Failed to execute 'addEventListener' on 'EventTarget': parameter 3"
|
||||
});
|
||||
} else if (utils.isObject(curArg)) {
|
||||
curArg = convertAddEventListenerOptions(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"
|
||||
});
|
||||
} else {
|
||||
curArg = conversions["boolean"](curArg, {
|
||||
context: "Failed to execute 'addEventListener' on 'EventTarget': parameter 3"
|
||||
});
|
||||
}
|
||||
}
|
||||
args.push(curArg);
|
||||
}
|
||||
return this[impl].addEventListener(...args);
|
||||
};
|
||||
|
||||
EventTarget.prototype.removeEventListener = function removeEventListener(type, callback) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
if (arguments.length < 2) {
|
||||
throw new 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"
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
{
|
||||
let curArg = arguments[1];
|
||||
if (curArg === null || curArg === undefined) {
|
||||
curArg = null;
|
||||
} else {
|
||||
curArg = utils.tryImplForWrapper(curArg);
|
||||
}
|
||||
args.push(curArg);
|
||||
}
|
||||
{
|
||||
let curArg = arguments[2];
|
||||
if (curArg !== undefined) {
|
||||
if (curArg === null || curArg === undefined) {
|
||||
curArg = convertEventListenerOptions(curArg, {
|
||||
context: "Failed to execute 'removeEventListener' on 'EventTarget': parameter 3"
|
||||
});
|
||||
} else if (utils.isObject(curArg)) {
|
||||
curArg = convertEventListenerOptions(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"
|
||||
});
|
||||
} else {
|
||||
curArg = conversions["boolean"](curArg, {
|
||||
context: "Failed to execute 'removeEventListener' on 'EventTarget': parameter 3"
|
||||
});
|
||||
}
|
||||
}
|
||||
args.push(curArg);
|
||||
}
|
||||
return this[impl].removeEventListener(...args);
|
||||
};
|
||||
|
||||
EventTarget.prototype.dispatchEvent = function dispatchEvent(event) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
if (arguments.length < 1) {
|
||||
throw new TypeError(
|
||||
"Failed to execute 'dispatchEvent' on 'EventTarget': 1 argument required, but only " +
|
||||
arguments.length +
|
||||
" present."
|
||||
);
|
||||
}
|
||||
const args = [];
|
||||
{
|
||||
let curArg = arguments[0];
|
||||
curArg = convertEvent(curArg, { context: "Failed to execute 'dispatchEvent' on 'EventTarget': parameter 1" });
|
||||
args.push(curArg);
|
||||
}
|
||||
return this[impl].dispatchEvent(...args);
|
||||
};
|
||||
|
||||
Object.defineProperty(EventTarget.prototype, Symbol.toStringTag, {
|
||||
value: "EventTarget",
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
const iface = {
|
||||
// When an interface-module that implements this interface as a mixin is loaded, it will append its own `.is()`
|
||||
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
|
||||
// implementing this mixin interface.
|
||||
_mixedIntoPredicates: [],
|
||||
is(obj) {
|
||||
if (obj) {
|
||||
if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(obj)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
isImpl(obj) {
|
||||
if (obj) {
|
||||
if (obj instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const wrapper = utils.wrapperForImpl(obj);
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(wrapper)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (module.exports.is(obj)) {
|
||||
return utils.implForWrapper(obj);
|
||||
}
|
||||
throw new TypeError(`${context} is not of type 'EventTarget'.`);
|
||||
},
|
||||
|
||||
create(constructorArgs, privateData) {
|
||||
let obj = Object.create(EventTarget.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return obj;
|
||||
},
|
||||
createImpl(constructorArgs, privateData) {
|
||||
let obj = Object.create(EventTarget.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return utils.implForWrapper(obj);
|
||||
},
|
||||
_internalSetup(obj) {},
|
||||
setup(obj, constructorArgs, privateData) {
|
||||
if (!privateData) privateData = {};
|
||||
|
||||
privateData.wrapper = obj;
|
||||
|
||||
this._internalSetup(obj);
|
||||
Object.defineProperty(obj, impl, {
|
||||
value: new Impl.implementation(constructorArgs, privateData),
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
obj[impl][utils.wrapperSymbol] = obj;
|
||||
if (Impl.init) {
|
||||
Impl.init(obj[impl], privateData);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
interface: EventTarget,
|
||||
expose: {
|
||||
Window: { EventTarget },
|
||||
Worker: { EventTarget },
|
||||
AudioWorklet: { EventTarget }
|
||||
}
|
||||
}; // iface
|
||||
module.exports = iface;
|
||||
|
||||
const Impl = require("../events/EventTarget-impl.js");
|
117
node_modules/jsdom/lib/jsdom/living/generated/External.js
generated
vendored
Normal file
117
node_modules/jsdom/lib/jsdom/living/generated/External.js
generated
vendored
Normal file
|
@ -0,0 +1,117 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const impl = utils.implSymbol;
|
||||
|
||||
function External() {
|
||||
throw new TypeError("Illegal constructor");
|
||||
}
|
||||
|
||||
Object.defineProperty(External, "prototype", {
|
||||
value: External.prototype,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: false
|
||||
});
|
||||
|
||||
External.prototype.AddSearchProvider = function AddSearchProvider() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl].AddSearchProvider();
|
||||
};
|
||||
|
||||
External.prototype.IsSearchProviderInstalled = function IsSearchProviderInstalled() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl].IsSearchProviderInstalled();
|
||||
};
|
||||
|
||||
Object.defineProperty(External.prototype, Symbol.toStringTag, {
|
||||
value: "External",
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
const iface = {
|
||||
// When an interface-module that implements this interface as a mixin is loaded, it will append its own `.is()`
|
||||
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
|
||||
// implementing this mixin interface.
|
||||
_mixedIntoPredicates: [],
|
||||
is(obj) {
|
||||
if (obj) {
|
||||
if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(obj)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
isImpl(obj) {
|
||||
if (obj) {
|
||||
if (obj instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const wrapper = utils.wrapperForImpl(obj);
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(wrapper)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (module.exports.is(obj)) {
|
||||
return utils.implForWrapper(obj);
|
||||
}
|
||||
throw new TypeError(`${context} is not of type 'External'.`);
|
||||
},
|
||||
|
||||
create(constructorArgs, privateData) {
|
||||
let obj = Object.create(External.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return obj;
|
||||
},
|
||||
createImpl(constructorArgs, privateData) {
|
||||
let obj = Object.create(External.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return utils.implForWrapper(obj);
|
||||
},
|
||||
_internalSetup(obj) {},
|
||||
setup(obj, constructorArgs, privateData) {
|
||||
if (!privateData) privateData = {};
|
||||
|
||||
privateData.wrapper = obj;
|
||||
|
||||
this._internalSetup(obj);
|
||||
Object.defineProperty(obj, impl, {
|
||||
value: new Impl.implementation(constructorArgs, privateData),
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
obj[impl][utils.wrapperSymbol] = obj;
|
||||
if (Impl.init) {
|
||||
Impl.init(obj[impl], privateData);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
interface: External,
|
||||
expose: {}
|
||||
}; // iface
|
||||
module.exports = iface;
|
||||
|
||||
const Impl = require("../window/External-impl.js");
|
182
node_modules/jsdom/lib/jsdom/living/generated/File.js
generated
vendored
Normal file
182
node_modules/jsdom/lib/jsdom/living/generated/File.js
generated
vendored
Normal file
|
@ -0,0 +1,182 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const isBlob = require("./Blob.js").is;
|
||||
const convertFilePropertyBag = require("./FilePropertyBag.js").convert;
|
||||
const impl = utils.implSymbol;
|
||||
const Blob = require("./Blob.js");
|
||||
|
||||
function File(fileBits, fileName) {
|
||||
if (new.target === undefined) {
|
||||
throw new TypeError(
|
||||
"Failed to construct 'File'. Please use the 'new' operator; this constructor " + "cannot be called as a function."
|
||||
);
|
||||
}
|
||||
|
||||
if (arguments.length < 2) {
|
||||
throw new 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 TypeError("Failed to construct 'File': parameter 1" + " is not an iterable object.");
|
||||
} else {
|
||||
const V = [];
|
||||
const tmp = curArg;
|
||||
for (let nextItem of tmp) {
|
||||
if (isBlob(nextItem)) {
|
||||
nextItem = utils.implForWrapper(nextItem);
|
||||
} else if (nextItem instanceof ArrayBuffer) {
|
||||
} else if (ArrayBuffer.isView(nextItem)) {
|
||||
} else {
|
||||
nextItem = conversions["USVString"](nextItem, {
|
||||
context: "Failed to construct 'File': parameter 1" + "'s element"
|
||||
});
|
||||
}
|
||||
V.push(nextItem);
|
||||
}
|
||||
curArg = V;
|
||||
}
|
||||
args.push(curArg);
|
||||
}
|
||||
{
|
||||
let curArg = arguments[1];
|
||||
curArg = conversions["USVString"](curArg, { context: "Failed to construct 'File': parameter 2" });
|
||||
args.push(curArg);
|
||||
}
|
||||
{
|
||||
let curArg = arguments[2];
|
||||
curArg = convertFilePropertyBag(curArg, { context: "Failed to construct 'File': parameter 3" });
|
||||
args.push(curArg);
|
||||
}
|
||||
|
||||
iface.setup(this, args);
|
||||
}
|
||||
|
||||
Object.setPrototypeOf(File.prototype, Blob.interface.prototype);
|
||||
Object.setPrototypeOf(File, Blob.interface);
|
||||
|
||||
Object.defineProperty(File, "prototype", {
|
||||
value: File.prototype,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: false
|
||||
});
|
||||
|
||||
Object.defineProperty(File.prototype, "name", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["name"];
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(File.prototype, "lastModified", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["lastModified"];
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(File.prototype, Symbol.toStringTag, {
|
||||
value: "File",
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
const iface = {
|
||||
// When an interface-module that implements this interface as a mixin is loaded, it will append its own `.is()`
|
||||
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
|
||||
// implementing this mixin interface.
|
||||
_mixedIntoPredicates: [],
|
||||
is(obj) {
|
||||
if (obj) {
|
||||
if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(obj)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
isImpl(obj) {
|
||||
if (obj) {
|
||||
if (obj instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const wrapper = utils.wrapperForImpl(obj);
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(wrapper)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (module.exports.is(obj)) {
|
||||
return utils.implForWrapper(obj);
|
||||
}
|
||||
throw new TypeError(`${context} is not of type 'File'.`);
|
||||
},
|
||||
|
||||
create(constructorArgs, privateData) {
|
||||
let obj = Object.create(File.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return obj;
|
||||
},
|
||||
createImpl(constructorArgs, privateData) {
|
||||
let obj = Object.create(File.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return utils.implForWrapper(obj);
|
||||
},
|
||||
_internalSetup(obj) {
|
||||
Blob._internalSetup(obj);
|
||||
},
|
||||
setup(obj, constructorArgs, privateData) {
|
||||
if (!privateData) privateData = {};
|
||||
|
||||
privateData.wrapper = obj;
|
||||
|
||||
this._internalSetup(obj);
|
||||
Object.defineProperty(obj, impl, {
|
||||
value: new Impl.implementation(constructorArgs, privateData),
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
obj[impl][utils.wrapperSymbol] = obj;
|
||||
if (Impl.init) {
|
||||
Impl.init(obj[impl], privateData);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
interface: File,
|
||||
expose: {
|
||||
Window: { File },
|
||||
Worker: { File }
|
||||
}
|
||||
}; // iface
|
||||
module.exports = iface;
|
||||
|
||||
const Impl = require("../file-api/File-impl.js");
|
301
node_modules/jsdom/lib/jsdom/living/generated/FileList.js
generated
vendored
Normal file
301
node_modules/jsdom/lib/jsdom/living/generated/FileList.js
generated
vendored
Normal file
|
@ -0,0 +1,301 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const impl = utils.implSymbol;
|
||||
|
||||
function FileList() {
|
||||
throw new TypeError("Illegal constructor");
|
||||
}
|
||||
|
||||
Object.defineProperty(FileList, "prototype", {
|
||||
value: FileList.prototype,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: false
|
||||
});
|
||||
|
||||
Object.defineProperty(FileList.prototype, Symbol.iterator, {
|
||||
writable: true,
|
||||
enumerable: false,
|
||||
configurable: true,
|
||||
value: Array.prototype[Symbol.iterator]
|
||||
});
|
||||
|
||||
FileList.prototype.item = function item(index) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
if (arguments.length < 1) {
|
||||
throw new 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" });
|
||||
args.push(curArg);
|
||||
}
|
||||
return utils.tryWrapperForImpl(this[impl].item(...args));
|
||||
};
|
||||
|
||||
Object.defineProperty(FileList.prototype, "length", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["length"];
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(FileList.prototype, Symbol.toStringTag, {
|
||||
value: "FileList",
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
const iface = {
|
||||
// When an interface-module that implements this interface as a mixin is loaded, it will append its own `.is()`
|
||||
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
|
||||
// implementing this mixin interface.
|
||||
_mixedIntoPredicates: [],
|
||||
is(obj) {
|
||||
if (obj) {
|
||||
if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(obj)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
isImpl(obj) {
|
||||
if (obj) {
|
||||
if (obj instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const wrapper = utils.wrapperForImpl(obj);
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(wrapper)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (module.exports.is(obj)) {
|
||||
return utils.implForWrapper(obj);
|
||||
}
|
||||
throw new TypeError(`${context} is not of type 'FileList'.`);
|
||||
},
|
||||
|
||||
create(constructorArgs, privateData) {
|
||||
let obj = Object.create(FileList.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return obj;
|
||||
},
|
||||
createImpl(constructorArgs, privateData) {
|
||||
let obj = Object.create(FileList.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return utils.implForWrapper(obj);
|
||||
},
|
||||
_internalSetup(obj) {},
|
||||
setup(obj, constructorArgs, privateData) {
|
||||
if (!privateData) privateData = {};
|
||||
|
||||
privateData.wrapper = obj;
|
||||
|
||||
this._internalSetup(obj);
|
||||
Object.defineProperty(obj, impl, {
|
||||
value: new Impl.implementation(constructorArgs, privateData),
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
obj = new Proxy(obj, {
|
||||
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[impl][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[impl].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);
|
||||
}
|
||||
if (target === receiver) {
|
||||
utils.isArrayIndexPropName(P);
|
||||
}
|
||||
let ownDesc;
|
||||
|
||||
if (utils.isArrayIndexPropName(P)) {
|
||||
const index = P >>> 0;
|
||||
const indexedValue = target[impl].item(index);
|
||||
if (indexedValue !== null) {
|
||||
ownDesc = {
|
||||
writable: false,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
value: utils.tryWrapperForImpl(indexedValue)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
if (ownDesc === undefined) {
|
||||
ownDesc = Reflect.getOwnPropertyDescriptor(target, P);
|
||||
}
|
||||
if (ownDesc === undefined) {
|
||||
const parent = Reflect.getPrototypeOf(target);
|
||||
if (parent !== null) {
|
||||
return Reflect.set(parent, P, V, receiver);
|
||||
}
|
||||
ownDesc = { writable: true, enumerable: true, configurable: true, value: undefined };
|
||||
}
|
||||
if (!ownDesc.writable) {
|
||||
return false;
|
||||
}
|
||||
if (!utils.isObject(receiver)) {
|
||||
return false;
|
||||
}
|
||||
const existingDesc = Reflect.getOwnPropertyDescriptor(receiver, P);
|
||||
let valueDesc;
|
||||
if (existingDesc !== undefined) {
|
||||
if (existingDesc.get || existingDesc.set) {
|
||||
return false;
|
||||
}
|
||||
if (!existingDesc.writable) {
|
||||
return false;
|
||||
}
|
||||
valueDesc = { value: V };
|
||||
} else {
|
||||
valueDesc = { writable: true, enumerable: true, configurable: true, value: V };
|
||||
}
|
||||
return Reflect.defineProperty(receiver, P, valueDesc);
|
||||
},
|
||||
|
||||
defineProperty(target, P, desc) {
|
||||
if (typeof P === "symbol") {
|
||||
return Reflect.defineProperty(target, P, desc);
|
||||
}
|
||||
|
||||
if (utils.isArrayIndexPropName(P)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return Reflect.defineProperty(target, P, desc);
|
||||
},
|
||||
|
||||
deleteProperty(target, P) {
|
||||
if (typeof P === "symbol") {
|
||||
return Reflect.deleteProperty(target, P);
|
||||
}
|
||||
|
||||
if (utils.isArrayIndexPropName(P)) {
|
||||
const index = P >>> 0;
|
||||
return !(target[impl].item(index) !== null);
|
||||
}
|
||||
|
||||
return Reflect.deleteProperty(target, P);
|
||||
},
|
||||
|
||||
preventExtensions() {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
obj[impl][utils.wrapperSymbol] = obj;
|
||||
if (Impl.init) {
|
||||
Impl.init(obj[impl], privateData);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
interface: FileList,
|
||||
expose: {
|
||||
Window: { FileList },
|
||||
Worker: { FileList }
|
||||
}
|
||||
}; // iface
|
||||
module.exports = iface;
|
||||
|
||||
const Impl = require("../file-api/FileList-impl.js");
|
32
node_modules/jsdom/lib/jsdom/living/generated/FilePropertyBag.js
generated
vendored
Normal file
32
node_modules/jsdom/lib/jsdom/living/generated/FilePropertyBag.js
generated
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const BlobPropertyBag = require("./BlobPropertyBag.js");
|
||||
|
||||
module.exports = {
|
||||
convertInherit(obj, ret, { context = "The provided value" } = {}) {
|
||||
BlobPropertyBag.convertInherit(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" });
|
||||
|
||||
ret[key] = value;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") {
|
||||
throw new TypeError(`${context} is not an object.`);
|
||||
}
|
||||
|
||||
const ret = Object.create(null);
|
||||
module.exports.convertInherit(obj, ret, { context });
|
||||
return ret;
|
||||
}
|
||||
};
|
435
node_modules/jsdom/lib/jsdom/living/generated/FileReader.js
generated
vendored
Normal file
435
node_modules/jsdom/lib/jsdom/living/generated/FileReader.js
generated
vendored
Normal file
|
@ -0,0 +1,435 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const convertBlob = require("./Blob.js").convert;
|
||||
const impl = utils.implSymbol;
|
||||
const EventTarget = require("./EventTarget.js");
|
||||
|
||||
module.exports = {
|
||||
createInterface: function(defaultPrivateData = {}) {
|
||||
function FileReader() {
|
||||
if (new.target === undefined) {
|
||||
throw new TypeError(
|
||||
"Failed to construct 'FileReader'. Please use the 'new' operator; this constructor " +
|
||||
"cannot be called as a function."
|
||||
);
|
||||
}
|
||||
|
||||
iface.setup(this);
|
||||
}
|
||||
|
||||
Object.setPrototypeOf(FileReader.prototype, EventTarget.interface.prototype);
|
||||
Object.setPrototypeOf(FileReader, EventTarget.interface);
|
||||
|
||||
Object.defineProperty(FileReader, "prototype", {
|
||||
value: FileReader.prototype,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: false
|
||||
});
|
||||
|
||||
FileReader.prototype.readAsArrayBuffer = function readAsArrayBuffer(blob) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
if (arguments.length < 1) {
|
||||
throw new TypeError(
|
||||
"Failed to execute 'readAsArrayBuffer' on 'FileReader': 1 argument required, but only " +
|
||||
arguments.length +
|
||||
" present."
|
||||
);
|
||||
}
|
||||
const args = [];
|
||||
{
|
||||
let curArg = arguments[0];
|
||||
curArg = convertBlob(curArg, { context: "Failed to execute 'readAsArrayBuffer' on 'FileReader': parameter 1" });
|
||||
args.push(curArg);
|
||||
}
|
||||
return this[impl].readAsArrayBuffer(...args);
|
||||
};
|
||||
|
||||
FileReader.prototype.readAsBinaryString = function readAsBinaryString(blob) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
if (arguments.length < 1) {
|
||||
throw new TypeError(
|
||||
"Failed to execute 'readAsBinaryString' on 'FileReader': 1 argument required, but only " +
|
||||
arguments.length +
|
||||
" present."
|
||||
);
|
||||
}
|
||||
const args = [];
|
||||
{
|
||||
let curArg = arguments[0];
|
||||
curArg = convertBlob(curArg, {
|
||||
context: "Failed to execute 'readAsBinaryString' on 'FileReader': parameter 1"
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
return this[impl].readAsBinaryString(...args);
|
||||
};
|
||||
|
||||
FileReader.prototype.readAsText = function readAsText(blob) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
if (arguments.length < 1) {
|
||||
throw new TypeError(
|
||||
"Failed to execute 'readAsText' on 'FileReader': 1 argument required, but only " +
|
||||
arguments.length +
|
||||
" present."
|
||||
);
|
||||
}
|
||||
const args = [];
|
||||
{
|
||||
let curArg = arguments[0];
|
||||
curArg = convertBlob(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"
|
||||
});
|
||||
}
|
||||
args.push(curArg);
|
||||
}
|
||||
return this[impl].readAsText(...args);
|
||||
};
|
||||
|
||||
FileReader.prototype.readAsDataURL = function readAsDataURL(blob) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
if (arguments.length < 1) {
|
||||
throw new TypeError(
|
||||
"Failed to execute 'readAsDataURL' on 'FileReader': 1 argument required, but only " +
|
||||
arguments.length +
|
||||
" present."
|
||||
);
|
||||
}
|
||||
const args = [];
|
||||
{
|
||||
let curArg = arguments[0];
|
||||
curArg = convertBlob(curArg, { context: "Failed to execute 'readAsDataURL' on 'FileReader': parameter 1" });
|
||||
args.push(curArg);
|
||||
}
|
||||
return this[impl].readAsDataURL(...args);
|
||||
};
|
||||
|
||||
FileReader.prototype.abort = function abort() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl].abort();
|
||||
};
|
||||
|
||||
Object.defineProperty(FileReader.prototype, "readyState", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["readyState"];
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(FileReader.prototype, "result", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return utils.tryWrapperForImpl(this[impl]["result"]);
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(FileReader.prototype, "error", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return utils.tryWrapperForImpl(this[impl]["error"]);
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(FileReader.prototype, "onloadstart", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return utils.tryWrapperForImpl(this[impl]["onloadstart"]);
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = utils.tryImplForWrapper(V);
|
||||
|
||||
this[impl]["onloadstart"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(FileReader.prototype, "onprogress", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return utils.tryWrapperForImpl(this[impl]["onprogress"]);
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = utils.tryImplForWrapper(V);
|
||||
|
||||
this[impl]["onprogress"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(FileReader.prototype, "onload", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return utils.tryWrapperForImpl(this[impl]["onload"]);
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = utils.tryImplForWrapper(V);
|
||||
|
||||
this[impl]["onload"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(FileReader.prototype, "onabort", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return utils.tryWrapperForImpl(this[impl]["onabort"]);
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = utils.tryImplForWrapper(V);
|
||||
|
||||
this[impl]["onabort"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(FileReader.prototype, "onerror", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return utils.tryWrapperForImpl(this[impl]["onerror"]);
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = utils.tryImplForWrapper(V);
|
||||
|
||||
this[impl]["onerror"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(FileReader.prototype, "onloadend", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return utils.tryWrapperForImpl(this[impl]["onloadend"]);
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = utils.tryImplForWrapper(V);
|
||||
|
||||
this[impl]["onloadend"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(FileReader, "EMPTY", {
|
||||
value: 0,
|
||||
enumerable: true
|
||||
});
|
||||
Object.defineProperty(FileReader.prototype, "EMPTY", {
|
||||
value: 0,
|
||||
enumerable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(FileReader, "LOADING", {
|
||||
value: 1,
|
||||
enumerable: true
|
||||
});
|
||||
Object.defineProperty(FileReader.prototype, "LOADING", {
|
||||
value: 1,
|
||||
enumerable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(FileReader, "DONE", {
|
||||
value: 2,
|
||||
enumerable: true
|
||||
});
|
||||
Object.defineProperty(FileReader.prototype, "DONE", {
|
||||
value: 2,
|
||||
enumerable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(FileReader.prototype, Symbol.toStringTag, {
|
||||
value: "FileReader",
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
const iface = {
|
||||
create(constructorArgs, privateData) {
|
||||
let obj = Object.create(FileReader.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return obj;
|
||||
},
|
||||
createImpl(constructorArgs, privateData) {
|
||||
let obj = Object.create(FileReader.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return utils.implForWrapper(obj);
|
||||
},
|
||||
_internalSetup(obj) {
|
||||
EventTarget._internalSetup(obj);
|
||||
},
|
||||
setup(obj, constructorArgs, privateData) {
|
||||
if (!privateData) privateData = {};
|
||||
|
||||
for (var prop in defaultPrivateData) {
|
||||
if (!(prop in privateData)) {
|
||||
privateData[prop] = defaultPrivateData[prop];
|
||||
}
|
||||
}
|
||||
|
||||
privateData.wrapper = obj;
|
||||
|
||||
this._internalSetup(obj);
|
||||
Object.defineProperty(obj, impl, {
|
||||
value: new Impl.implementation(constructorArgs, privateData),
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
obj[impl][utils.wrapperSymbol] = obj;
|
||||
if (Impl.init) {
|
||||
Impl.init(obj[impl], privateData);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
interface: FileReader,
|
||||
expose: {
|
||||
Window: { FileReader },
|
||||
Worker: { FileReader }
|
||||
}
|
||||
}; // iface
|
||||
return iface;
|
||||
}, // createInterface
|
||||
|
||||
// When an interface-module that implements this interface as a mixin is loaded, it will append its own `.is()`
|
||||
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
|
||||
// implementing this mixin interface.
|
||||
_mixedIntoPredicates: [],
|
||||
is(obj) {
|
||||
if (obj) {
|
||||
if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(obj)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
isImpl(obj) {
|
||||
if (obj) {
|
||||
if (obj instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const wrapper = utils.wrapperForImpl(obj);
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(wrapper)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (module.exports.is(obj)) {
|
||||
return utils.implForWrapper(obj);
|
||||
}
|
||||
throw new TypeError(`${context} is not of type 'FileReader'.`);
|
||||
}
|
||||
}; // module.exports
|
||||
|
||||
const Impl = require("../file-api/FileReader-impl.js");
|
147
node_modules/jsdom/lib/jsdom/living/generated/FocusEvent.js
generated
vendored
Normal file
147
node_modules/jsdom/lib/jsdom/living/generated/FocusEvent.js
generated
vendored
Normal file
|
@ -0,0 +1,147 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const convertFocusEventInit = require("./FocusEventInit.js").convert;
|
||||
const impl = utils.implSymbol;
|
||||
const UIEvent = require("./UIEvent.js");
|
||||
|
||||
function FocusEvent(type) {
|
||||
if (new.target === undefined) {
|
||||
throw new TypeError(
|
||||
"Failed to construct 'FocusEvent'. Please use the 'new' operator; this constructor " +
|
||||
"cannot be called as a function."
|
||||
);
|
||||
}
|
||||
|
||||
if (arguments.length < 1) {
|
||||
throw new 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" });
|
||||
args.push(curArg);
|
||||
}
|
||||
{
|
||||
let curArg = arguments[1];
|
||||
curArg = convertFocusEventInit(curArg, { context: "Failed to construct 'FocusEvent': parameter 2" });
|
||||
args.push(curArg);
|
||||
}
|
||||
|
||||
iface.setup(this, args);
|
||||
}
|
||||
|
||||
Object.setPrototypeOf(FocusEvent.prototype, UIEvent.interface.prototype);
|
||||
Object.setPrototypeOf(FocusEvent, UIEvent.interface);
|
||||
|
||||
Object.defineProperty(FocusEvent, "prototype", {
|
||||
value: FocusEvent.prototype,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: false
|
||||
});
|
||||
|
||||
Object.defineProperty(FocusEvent.prototype, "relatedTarget", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return utils.tryWrapperForImpl(this[impl]["relatedTarget"]);
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(FocusEvent.prototype, Symbol.toStringTag, {
|
||||
value: "FocusEvent",
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
const iface = {
|
||||
// When an interface-module that implements this interface as a mixin is loaded, it will append its own `.is()`
|
||||
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
|
||||
// implementing this mixin interface.
|
||||
_mixedIntoPredicates: [],
|
||||
is(obj) {
|
||||
if (obj) {
|
||||
if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(obj)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
isImpl(obj) {
|
||||
if (obj) {
|
||||
if (obj instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const wrapper = utils.wrapperForImpl(obj);
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(wrapper)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (module.exports.is(obj)) {
|
||||
return utils.implForWrapper(obj);
|
||||
}
|
||||
throw new TypeError(`${context} is not of type 'FocusEvent'.`);
|
||||
},
|
||||
|
||||
create(constructorArgs, privateData) {
|
||||
let obj = Object.create(FocusEvent.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return obj;
|
||||
},
|
||||
createImpl(constructorArgs, privateData) {
|
||||
let obj = Object.create(FocusEvent.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return utils.implForWrapper(obj);
|
||||
},
|
||||
_internalSetup(obj) {
|
||||
UIEvent._internalSetup(obj);
|
||||
},
|
||||
setup(obj, constructorArgs, privateData) {
|
||||
if (!privateData) privateData = {};
|
||||
|
||||
privateData.wrapper = obj;
|
||||
|
||||
this._internalSetup(obj);
|
||||
Object.defineProperty(obj, impl, {
|
||||
value: new Impl.implementation(constructorArgs, privateData),
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
obj[impl][utils.wrapperSymbol] = obj;
|
||||
if (Impl.init) {
|
||||
Impl.init(obj[impl], privateData);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
interface: FocusEvent,
|
||||
expose: {
|
||||
Window: { FocusEvent }
|
||||
}
|
||||
}; // iface
|
||||
module.exports = iface;
|
||||
|
||||
const Impl = require("../events/FocusEvent-impl.js");
|
38
node_modules/jsdom/lib/jsdom/living/generated/FocusEventInit.js
generated
vendored
Normal file
38
node_modules/jsdom/lib/jsdom/living/generated/FocusEventInit.js
generated
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const convertEventTarget = require("./EventTarget.js").convert;
|
||||
const UIEventInit = require("./UIEventInit.js");
|
||||
|
||||
module.exports = {
|
||||
convertInherit(obj, ret, { context = "The provided value" } = {}) {
|
||||
UIEventInit.convertInherit(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 = convertEventTarget(value, { context: context + " has member relatedTarget that" });
|
||||
}
|
||||
ret[key] = value;
|
||||
} else {
|
||||
ret[key] = null;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") {
|
||||
throw new TypeError(`${context} is not an object.`);
|
||||
}
|
||||
|
||||
const ret = Object.create(null);
|
||||
module.exports.convertInherit(obj, ret, { context });
|
||||
return ret;
|
||||
}
|
||||
};
|
419
node_modules/jsdom/lib/jsdom/living/generated/FormData.js
generated
vendored
Normal file
419
node_modules/jsdom/lib/jsdom/living/generated/FormData.js
generated
vendored
Normal file
|
@ -0,0 +1,419 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const convertHTMLFormElement = require("./HTMLFormElement.js").convert;
|
||||
const isBlob = require("./Blob.js").is;
|
||||
const convertBlob = require("./Blob.js").convert;
|
||||
const impl = utils.implSymbol;
|
||||
|
||||
const IteratorPrototype = Object.create(utils.IteratorPrototype, {
|
||||
next: {
|
||||
value: function next() {
|
||||
const internal = this[utils.iterInternalSymbol];
|
||||
const { target, kind, index } = internal;
|
||||
const values = Array.from(target[impl]);
|
||||
const len = values.length;
|
||||
if (index >= len) {
|
||||
return { value: undefined, done: true };
|
||||
}
|
||||
|
||||
const pair = values[index];
|
||||
internal.index = index + 1;
|
||||
const [key, value] = pair.map(utils.tryWrapperForImpl);
|
||||
|
||||
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 };
|
||||
},
|
||||
writable: true,
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
},
|
||||
[Symbol.toStringTag]: {
|
||||
value: "FormDataIterator",
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
|
||||
function FormData() {
|
||||
if (new.target === undefined) {
|
||||
throw new TypeError(
|
||||
"Failed to construct 'FormData'. Please use the 'new' operator; this constructor " +
|
||||
"cannot be called as a function."
|
||||
);
|
||||
}
|
||||
const args = [];
|
||||
{
|
||||
let curArg = arguments[0];
|
||||
if (curArg !== undefined) {
|
||||
curArg = convertHTMLFormElement(curArg, { context: "Failed to construct 'FormData': parameter 1" });
|
||||
}
|
||||
args.push(curArg);
|
||||
}
|
||||
|
||||
iface.setup(this, args);
|
||||
}
|
||||
|
||||
Object.defineProperty(FormData, "prototype", {
|
||||
value: FormData.prototype,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: false
|
||||
});
|
||||
|
||||
Object.defineProperty(FormData.prototype, Symbol.iterator, {
|
||||
writable: true,
|
||||
enumerable: false,
|
||||
configurable: true,
|
||||
value: function entries() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
return module.exports.createDefaultIterator(this, "key+value");
|
||||
}
|
||||
});
|
||||
FormData.prototype.forEach = function forEach(callback) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
if (arguments.length < 1) {
|
||||
throw new TypeError("Failed to execute 'forEach' on 'FormData': 1 argument required, " + "but only 0 present.");
|
||||
}
|
||||
if (typeof callback !== "function") {
|
||||
throw new TypeError(
|
||||
"Failed to execute 'forEach' on 'FormData': The callback provided " + "as parameter 1 is not a function."
|
||||
);
|
||||
}
|
||||
const thisArg = arguments[1];
|
||||
let pairs = Array.from(this[impl]);
|
||||
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[impl]);
|
||||
i++;
|
||||
}
|
||||
};
|
||||
FormData.prototype.append = function append(name, value) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
if (arguments.length < 2) {
|
||||
throw new 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" });
|
||||
args.push(curArg);
|
||||
}
|
||||
{
|
||||
let curArg = arguments[1];
|
||||
if (isBlob(curArg)) {
|
||||
{
|
||||
let curArg = arguments[1];
|
||||
curArg = convertBlob(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"
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
let curArg = arguments[0];
|
||||
curArg = conversions["USVString"](curArg, { context: "Failed to execute 'append' on 'FormData': parameter 1" });
|
||||
args.push(curArg);
|
||||
}
|
||||
{
|
||||
let curArg = arguments[1];
|
||||
curArg = convertBlob(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"
|
||||
});
|
||||
}
|
||||
args.push(curArg);
|
||||
}
|
||||
}
|
||||
return this[impl].append(...args);
|
||||
};
|
||||
|
||||
FormData.prototype.delete = function _delete(name) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
if (arguments.length < 1) {
|
||||
throw new 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" });
|
||||
args.push(curArg);
|
||||
}
|
||||
return this[impl].delete(...args);
|
||||
};
|
||||
|
||||
FormData.prototype.get = function get(name) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
if (arguments.length < 1) {
|
||||
throw new 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" });
|
||||
args.push(curArg);
|
||||
}
|
||||
return utils.tryWrapperForImpl(this[impl].get(...args));
|
||||
};
|
||||
|
||||
FormData.prototype.getAll = function getAll(name) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
if (arguments.length < 1) {
|
||||
throw new 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" });
|
||||
args.push(curArg);
|
||||
}
|
||||
return utils.tryWrapperForImpl(this[impl].getAll(...args));
|
||||
};
|
||||
|
||||
FormData.prototype.has = function has(name) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
if (arguments.length < 1) {
|
||||
throw new 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" });
|
||||
args.push(curArg);
|
||||
}
|
||||
return this[impl].has(...args);
|
||||
};
|
||||
|
||||
FormData.prototype.set = function set(name, value) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
if (arguments.length < 2) {
|
||||
throw new 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" });
|
||||
args.push(curArg);
|
||||
}
|
||||
{
|
||||
let curArg = arguments[1];
|
||||
if (isBlob(curArg)) {
|
||||
{
|
||||
let curArg = arguments[1];
|
||||
curArg = convertBlob(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"
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
let curArg = arguments[0];
|
||||
curArg = conversions["USVString"](curArg, { context: "Failed to execute 'set' on 'FormData': parameter 1" });
|
||||
args.push(curArg);
|
||||
}
|
||||
{
|
||||
let curArg = arguments[1];
|
||||
curArg = convertBlob(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" });
|
||||
}
|
||||
args.push(curArg);
|
||||
}
|
||||
}
|
||||
return this[impl].set(...args);
|
||||
};
|
||||
|
||||
FormData.prototype.entries = FormData.prototype[Symbol.iterator];
|
||||
|
||||
FormData.prototype.keys = function keys() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
return module.exports.createDefaultIterator(this, "key");
|
||||
};
|
||||
|
||||
FormData.prototype.values = function values() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
return module.exports.createDefaultIterator(this, "value");
|
||||
};
|
||||
|
||||
Object.defineProperty(FormData.prototype, Symbol.toStringTag, {
|
||||
value: "FormData",
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
const iface = {
|
||||
// When an interface-module that implements this interface as a mixin is loaded, it will append its own `.is()`
|
||||
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
|
||||
// implementing this mixin interface.
|
||||
_mixedIntoPredicates: [],
|
||||
is(obj) {
|
||||
if (obj) {
|
||||
if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(obj)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
isImpl(obj) {
|
||||
if (obj) {
|
||||
if (obj instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const wrapper = utils.wrapperForImpl(obj);
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(wrapper)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (module.exports.is(obj)) {
|
||||
return utils.implForWrapper(obj);
|
||||
}
|
||||
throw new TypeError(`${context} is not of type 'FormData'.`);
|
||||
},
|
||||
|
||||
createDefaultIterator(target, kind) {
|
||||
const iterator = Object.create(IteratorPrototype);
|
||||
Object.defineProperty(iterator, utils.iterInternalSymbol, {
|
||||
value: { target, kind, index: 0 },
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
return iterator;
|
||||
},
|
||||
|
||||
create(constructorArgs, privateData) {
|
||||
let obj = Object.create(FormData.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return obj;
|
||||
},
|
||||
createImpl(constructorArgs, privateData) {
|
||||
let obj = Object.create(FormData.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return utils.implForWrapper(obj);
|
||||
},
|
||||
_internalSetup(obj) {},
|
||||
setup(obj, constructorArgs, privateData) {
|
||||
if (!privateData) privateData = {};
|
||||
|
||||
privateData.wrapper = obj;
|
||||
|
||||
this._internalSetup(obj);
|
||||
Object.defineProperty(obj, impl, {
|
||||
value: new Impl.implementation(constructorArgs, privateData),
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
obj[impl][utils.wrapperSymbol] = obj;
|
||||
if (Impl.init) {
|
||||
Impl.init(obj[impl], privateData);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
interface: FormData,
|
||||
expose: {
|
||||
Window: { FormData },
|
||||
Worker: { FormData }
|
||||
}
|
||||
}; // iface
|
||||
module.exports = iface;
|
||||
|
||||
const Impl = require("../xhr/FormData-impl.js");
|
30
node_modules/jsdom/lib/jsdom/living/generated/GetRootNodeOptions.js
generated
vendored
Normal file
30
node_modules/jsdom/lib/jsdom/living/generated/GetRootNodeOptions.js
generated
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
module.exports = {
|
||||
convertInherit(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" });
|
||||
|
||||
ret[key] = value;
|
||||
} else {
|
||||
ret[key] = false;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") {
|
||||
throw new TypeError(`${context} is not an object.`);
|
||||
}
|
||||
|
||||
const ret = Object.create(null);
|
||||
module.exports.convertInherit(obj, ret, { context });
|
||||
return ret;
|
||||
}
|
||||
};
|
1511
node_modules/jsdom/lib/jsdom/living/generated/GlobalEventHandlers.js
generated
vendored
Normal file
1511
node_modules/jsdom/lib/jsdom/living/generated/GlobalEventHandlers.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
667
node_modules/jsdom/lib/jsdom/living/generated/HTMLAnchorElement.js
generated
vendored
Normal file
667
node_modules/jsdom/lib/jsdom/living/generated/HTMLAnchorElement.js
generated
vendored
Normal file
|
@ -0,0 +1,667 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const impl = utils.implSymbol;
|
||||
const HTMLElement = require("./HTMLElement.js");
|
||||
const HTMLHyperlinkElementUtils = require("./HTMLHyperlinkElementUtils.js");
|
||||
|
||||
function HTMLAnchorElement() {
|
||||
throw new TypeError("Illegal constructor");
|
||||
}
|
||||
|
||||
Object.setPrototypeOf(HTMLAnchorElement.prototype, HTMLElement.interface.prototype);
|
||||
Object.setPrototypeOf(HTMLAnchorElement, HTMLElement.interface);
|
||||
|
||||
Object.defineProperty(HTMLAnchorElement, "prototype", {
|
||||
value: HTMLAnchorElement.prototype,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: false
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLAnchorElement.prototype, "target", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
const value = this.getAttribute("target");
|
||||
return value === null ? "" : value;
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["DOMString"](V, {
|
||||
context: "Failed to set the 'target' property on 'HTMLAnchorElement': The provided value"
|
||||
});
|
||||
|
||||
this.setAttribute("target", V);
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLAnchorElement.prototype, "download", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
const value = this.getAttribute("download");
|
||||
return value === null ? "" : value;
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["DOMString"](V, {
|
||||
context: "Failed to set the 'download' property on 'HTMLAnchorElement': The provided value"
|
||||
});
|
||||
|
||||
this.setAttribute("download", V);
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLAnchorElement.prototype, "rel", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
const value = this.getAttribute("rel");
|
||||
return value === null ? "" : value;
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["DOMString"](V, {
|
||||
context: "Failed to set the 'rel' property on 'HTMLAnchorElement': The provided value"
|
||||
});
|
||||
|
||||
this.setAttribute("rel", V);
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLAnchorElement.prototype, "hreflang", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
const value = this.getAttribute("hreflang");
|
||||
return value === null ? "" : value;
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["DOMString"](V, {
|
||||
context: "Failed to set the 'hreflang' property on 'HTMLAnchorElement': The provided value"
|
||||
});
|
||||
|
||||
this.setAttribute("hreflang", V);
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLAnchorElement.prototype, "type", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
const value = this.getAttribute("type");
|
||||
return value === null ? "" : value;
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["DOMString"](V, {
|
||||
context: "Failed to set the 'type' property on 'HTMLAnchorElement': The provided value"
|
||||
});
|
||||
|
||||
this.setAttribute("type", V);
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLAnchorElement.prototype, "text", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["text"];
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["DOMString"](V, {
|
||||
context: "Failed to set the 'text' property on 'HTMLAnchorElement': The provided value"
|
||||
});
|
||||
|
||||
this[impl]["text"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLAnchorElement.prototype, "coords", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
const value = this.getAttribute("coords");
|
||||
return value === null ? "" : value;
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["DOMString"](V, {
|
||||
context: "Failed to set the 'coords' property on 'HTMLAnchorElement': The provided value"
|
||||
});
|
||||
|
||||
this.setAttribute("coords", V);
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLAnchorElement.prototype, "charset", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
const value = this.getAttribute("charset");
|
||||
return value === null ? "" : value;
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["DOMString"](V, {
|
||||
context: "Failed to set the 'charset' property on 'HTMLAnchorElement': The provided value"
|
||||
});
|
||||
|
||||
this.setAttribute("charset", V);
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLAnchorElement.prototype, "name", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
const value = this.getAttribute("name");
|
||||
return value === null ? "" : value;
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["DOMString"](V, {
|
||||
context: "Failed to set the 'name' property on 'HTMLAnchorElement': The provided value"
|
||||
});
|
||||
|
||||
this.setAttribute("name", V);
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLAnchorElement.prototype, "rev", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
const value = this.getAttribute("rev");
|
||||
return value === null ? "" : value;
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["DOMString"](V, {
|
||||
context: "Failed to set the 'rev' property on 'HTMLAnchorElement': The provided value"
|
||||
});
|
||||
|
||||
this.setAttribute("rev", V);
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLAnchorElement.prototype, "shape", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
const value = this.getAttribute("shape");
|
||||
return value === null ? "" : value;
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["DOMString"](V, {
|
||||
context: "Failed to set the 'shape' property on 'HTMLAnchorElement': The provided value"
|
||||
});
|
||||
|
||||
this.setAttribute("shape", V);
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLAnchorElement.prototype, "href", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["href"];
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, {
|
||||
context: "Failed to set the 'href' property on 'HTMLAnchorElement': The provided value"
|
||||
});
|
||||
|
||||
this[impl]["href"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
HTMLAnchorElement.prototype.toString = function toString() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
return this[impl]["href"];
|
||||
};
|
||||
|
||||
Object.defineProperty(HTMLAnchorElement.prototype, "origin", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["origin"];
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLAnchorElement.prototype, "protocol", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["protocol"];
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, {
|
||||
context: "Failed to set the 'protocol' property on 'HTMLAnchorElement': The provided value"
|
||||
});
|
||||
|
||||
this[impl]["protocol"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLAnchorElement.prototype, "username", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["username"];
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, {
|
||||
context: "Failed to set the 'username' property on 'HTMLAnchorElement': The provided value"
|
||||
});
|
||||
|
||||
this[impl]["username"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLAnchorElement.prototype, "password", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["password"];
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, {
|
||||
context: "Failed to set the 'password' property on 'HTMLAnchorElement': The provided value"
|
||||
});
|
||||
|
||||
this[impl]["password"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLAnchorElement.prototype, "host", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["host"];
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, {
|
||||
context: "Failed to set the 'host' property on 'HTMLAnchorElement': The provided value"
|
||||
});
|
||||
|
||||
this[impl]["host"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLAnchorElement.prototype, "hostname", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["hostname"];
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, {
|
||||
context: "Failed to set the 'hostname' property on 'HTMLAnchorElement': The provided value"
|
||||
});
|
||||
|
||||
this[impl]["hostname"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLAnchorElement.prototype, "port", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["port"];
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, {
|
||||
context: "Failed to set the 'port' property on 'HTMLAnchorElement': The provided value"
|
||||
});
|
||||
|
||||
this[impl]["port"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLAnchorElement.prototype, "pathname", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["pathname"];
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, {
|
||||
context: "Failed to set the 'pathname' property on 'HTMLAnchorElement': The provided value"
|
||||
});
|
||||
|
||||
this[impl]["pathname"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLAnchorElement.prototype, "search", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["search"];
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, {
|
||||
context: "Failed to set the 'search' property on 'HTMLAnchorElement': The provided value"
|
||||
});
|
||||
|
||||
this[impl]["search"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLAnchorElement.prototype, "hash", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["hash"];
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, {
|
||||
context: "Failed to set the 'hash' property on 'HTMLAnchorElement': The provided value"
|
||||
});
|
||||
|
||||
this[impl]["hash"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLAnchorElement.prototype, Symbol.toStringTag, {
|
||||
value: "HTMLAnchorElement",
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
const iface = {
|
||||
// When an interface-module that implements this interface as a mixin is loaded, it will append its own `.is()`
|
||||
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
|
||||
// implementing this mixin interface.
|
||||
_mixedIntoPredicates: [],
|
||||
is(obj) {
|
||||
if (obj) {
|
||||
if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(obj)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
isImpl(obj) {
|
||||
if (obj) {
|
||||
if (obj instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const wrapper = utils.wrapperForImpl(obj);
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(wrapper)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (module.exports.is(obj)) {
|
||||
return utils.implForWrapper(obj);
|
||||
}
|
||||
throw new TypeError(`${context} is not of type 'HTMLAnchorElement'.`);
|
||||
},
|
||||
|
||||
create(constructorArgs, privateData) {
|
||||
let obj = Object.create(HTMLAnchorElement.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return obj;
|
||||
},
|
||||
createImpl(constructorArgs, privateData) {
|
||||
let obj = Object.create(HTMLAnchorElement.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return utils.implForWrapper(obj);
|
||||
},
|
||||
_internalSetup(obj) {
|
||||
HTMLElement._internalSetup(obj);
|
||||
},
|
||||
setup(obj, constructorArgs, privateData) {
|
||||
if (!privateData) privateData = {};
|
||||
|
||||
privateData.wrapper = obj;
|
||||
|
||||
this._internalSetup(obj);
|
||||
Object.defineProperty(obj, impl, {
|
||||
value: new Impl.implementation(constructorArgs, privateData),
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
obj[impl][utils.wrapperSymbol] = obj;
|
||||
if (Impl.init) {
|
||||
Impl.init(obj[impl], privateData);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
interface: HTMLAnchorElement,
|
||||
expose: {
|
||||
Window: { HTMLAnchorElement }
|
||||
}
|
||||
}; // iface
|
||||
module.exports = iface;
|
||||
|
||||
HTMLHyperlinkElementUtils._mixedIntoPredicates.push(module.exports.is);
|
||||
|
||||
const Impl = require("../nodes/HTMLAnchorElement-impl.js");
|
541
node_modules/jsdom/lib/jsdom/living/generated/HTMLAreaElement.js
generated
vendored
Normal file
541
node_modules/jsdom/lib/jsdom/living/generated/HTMLAreaElement.js
generated
vendored
Normal file
|
@ -0,0 +1,541 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const impl = utils.implSymbol;
|
||||
const HTMLElement = require("./HTMLElement.js");
|
||||
const HTMLHyperlinkElementUtils = require("./HTMLHyperlinkElementUtils.js");
|
||||
|
||||
function HTMLAreaElement() {
|
||||
throw new TypeError("Illegal constructor");
|
||||
}
|
||||
|
||||
Object.setPrototypeOf(HTMLAreaElement.prototype, HTMLElement.interface.prototype);
|
||||
Object.setPrototypeOf(HTMLAreaElement, HTMLElement.interface);
|
||||
|
||||
Object.defineProperty(HTMLAreaElement, "prototype", {
|
||||
value: HTMLAreaElement.prototype,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: false
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLAreaElement.prototype, "alt", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
const value = this.getAttribute("alt");
|
||||
return value === null ? "" : value;
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["DOMString"](V, {
|
||||
context: "Failed to set the 'alt' property on 'HTMLAreaElement': The provided value"
|
||||
});
|
||||
|
||||
this.setAttribute("alt", V);
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLAreaElement.prototype, "coords", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
const value = this.getAttribute("coords");
|
||||
return value === null ? "" : value;
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["DOMString"](V, {
|
||||
context: "Failed to set the 'coords' property on 'HTMLAreaElement': The provided value"
|
||||
});
|
||||
|
||||
this.setAttribute("coords", V);
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLAreaElement.prototype, "shape", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
const value = this.getAttribute("shape");
|
||||
return value === null ? "" : value;
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["DOMString"](V, {
|
||||
context: "Failed to set the 'shape' property on 'HTMLAreaElement': The provided value"
|
||||
});
|
||||
|
||||
this.setAttribute("shape", V);
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLAreaElement.prototype, "target", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
const value = this.getAttribute("target");
|
||||
return value === null ? "" : value;
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["DOMString"](V, {
|
||||
context: "Failed to set the 'target' property on 'HTMLAreaElement': The provided value"
|
||||
});
|
||||
|
||||
this.setAttribute("target", V);
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLAreaElement.prototype, "rel", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
const value = this.getAttribute("rel");
|
||||
return value === null ? "" : value;
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["DOMString"](V, {
|
||||
context: "Failed to set the 'rel' property on 'HTMLAreaElement': The provided value"
|
||||
});
|
||||
|
||||
this.setAttribute("rel", V);
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLAreaElement.prototype, "noHref", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this.hasAttribute("noHref");
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["boolean"](V, {
|
||||
context: "Failed to set the 'noHref' property on 'HTMLAreaElement': The provided value"
|
||||
});
|
||||
|
||||
if (V) {
|
||||
this.setAttribute("noHref", "");
|
||||
} else {
|
||||
this.removeAttribute("noHref");
|
||||
}
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLAreaElement.prototype, "href", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["href"];
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, {
|
||||
context: "Failed to set the 'href' property on 'HTMLAreaElement': The provided value"
|
||||
});
|
||||
|
||||
this[impl]["href"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
HTMLAreaElement.prototype.toString = function toString() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
return this[impl]["href"];
|
||||
};
|
||||
|
||||
Object.defineProperty(HTMLAreaElement.prototype, "origin", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["origin"];
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLAreaElement.prototype, "protocol", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["protocol"];
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, {
|
||||
context: "Failed to set the 'protocol' property on 'HTMLAreaElement': The provided value"
|
||||
});
|
||||
|
||||
this[impl]["protocol"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLAreaElement.prototype, "username", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["username"];
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, {
|
||||
context: "Failed to set the 'username' property on 'HTMLAreaElement': The provided value"
|
||||
});
|
||||
|
||||
this[impl]["username"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLAreaElement.prototype, "password", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["password"];
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, {
|
||||
context: "Failed to set the 'password' property on 'HTMLAreaElement': The provided value"
|
||||
});
|
||||
|
||||
this[impl]["password"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLAreaElement.prototype, "host", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["host"];
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, {
|
||||
context: "Failed to set the 'host' property on 'HTMLAreaElement': The provided value"
|
||||
});
|
||||
|
||||
this[impl]["host"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLAreaElement.prototype, "hostname", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["hostname"];
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, {
|
||||
context: "Failed to set the 'hostname' property on 'HTMLAreaElement': The provided value"
|
||||
});
|
||||
|
||||
this[impl]["hostname"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLAreaElement.prototype, "port", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["port"];
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, {
|
||||
context: "Failed to set the 'port' property on 'HTMLAreaElement': The provided value"
|
||||
});
|
||||
|
||||
this[impl]["port"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLAreaElement.prototype, "pathname", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["pathname"];
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, {
|
||||
context: "Failed to set the 'pathname' property on 'HTMLAreaElement': The provided value"
|
||||
});
|
||||
|
||||
this[impl]["pathname"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLAreaElement.prototype, "search", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["search"];
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, {
|
||||
context: "Failed to set the 'search' property on 'HTMLAreaElement': The provided value"
|
||||
});
|
||||
|
||||
this[impl]["search"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLAreaElement.prototype, "hash", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["hash"];
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, {
|
||||
context: "Failed to set the 'hash' property on 'HTMLAreaElement': The provided value"
|
||||
});
|
||||
|
||||
this[impl]["hash"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLAreaElement.prototype, Symbol.toStringTag, {
|
||||
value: "HTMLAreaElement",
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
const iface = {
|
||||
// When an interface-module that implements this interface as a mixin is loaded, it will append its own `.is()`
|
||||
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
|
||||
// implementing this mixin interface.
|
||||
_mixedIntoPredicates: [],
|
||||
is(obj) {
|
||||
if (obj) {
|
||||
if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(obj)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
isImpl(obj) {
|
||||
if (obj) {
|
||||
if (obj instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const wrapper = utils.wrapperForImpl(obj);
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(wrapper)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (module.exports.is(obj)) {
|
||||
return utils.implForWrapper(obj);
|
||||
}
|
||||
throw new TypeError(`${context} is not of type 'HTMLAreaElement'.`);
|
||||
},
|
||||
|
||||
create(constructorArgs, privateData) {
|
||||
let obj = Object.create(HTMLAreaElement.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return obj;
|
||||
},
|
||||
createImpl(constructorArgs, privateData) {
|
||||
let obj = Object.create(HTMLAreaElement.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return utils.implForWrapper(obj);
|
||||
},
|
||||
_internalSetup(obj) {
|
||||
HTMLElement._internalSetup(obj);
|
||||
},
|
||||
setup(obj, constructorArgs, privateData) {
|
||||
if (!privateData) privateData = {};
|
||||
|
||||
privateData.wrapper = obj;
|
||||
|
||||
this._internalSetup(obj);
|
||||
Object.defineProperty(obj, impl, {
|
||||
value: new Impl.implementation(constructorArgs, privateData),
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
obj[impl][utils.wrapperSymbol] = obj;
|
||||
if (Impl.init) {
|
||||
Impl.init(obj[impl], privateData);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
interface: HTMLAreaElement,
|
||||
expose: {
|
||||
Window: { HTMLAreaElement }
|
||||
}
|
||||
}; // iface
|
||||
module.exports = iface;
|
||||
|
||||
HTMLHyperlinkElementUtils._mixedIntoPredicates.push(module.exports.is);
|
||||
|
||||
const Impl = require("../nodes/HTMLAreaElement-impl.js");
|
109
node_modules/jsdom/lib/jsdom/living/generated/HTMLAudioElement.js
generated
vendored
Normal file
109
node_modules/jsdom/lib/jsdom/living/generated/HTMLAudioElement.js
generated
vendored
Normal file
|
@ -0,0 +1,109 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const impl = utils.implSymbol;
|
||||
const HTMLMediaElement = require("./HTMLMediaElement.js");
|
||||
|
||||
function HTMLAudioElement() {
|
||||
throw new TypeError("Illegal constructor");
|
||||
}
|
||||
|
||||
Object.setPrototypeOf(HTMLAudioElement.prototype, HTMLMediaElement.interface.prototype);
|
||||
Object.setPrototypeOf(HTMLAudioElement, HTMLMediaElement.interface);
|
||||
|
||||
Object.defineProperty(HTMLAudioElement, "prototype", {
|
||||
value: HTMLAudioElement.prototype,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: false
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLAudioElement.prototype, Symbol.toStringTag, {
|
||||
value: "HTMLAudioElement",
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
const iface = {
|
||||
// When an interface-module that implements this interface as a mixin is loaded, it will append its own `.is()`
|
||||
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
|
||||
// implementing this mixin interface.
|
||||
_mixedIntoPredicates: [],
|
||||
is(obj) {
|
||||
if (obj) {
|
||||
if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(obj)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
isImpl(obj) {
|
||||
if (obj) {
|
||||
if (obj instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const wrapper = utils.wrapperForImpl(obj);
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(wrapper)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (module.exports.is(obj)) {
|
||||
return utils.implForWrapper(obj);
|
||||
}
|
||||
throw new TypeError(`${context} is not of type 'HTMLAudioElement'.`);
|
||||
},
|
||||
|
||||
create(constructorArgs, privateData) {
|
||||
let obj = Object.create(HTMLAudioElement.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return obj;
|
||||
},
|
||||
createImpl(constructorArgs, privateData) {
|
||||
let obj = Object.create(HTMLAudioElement.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return utils.implForWrapper(obj);
|
||||
},
|
||||
_internalSetup(obj) {
|
||||
HTMLMediaElement._internalSetup(obj);
|
||||
},
|
||||
setup(obj, constructorArgs, privateData) {
|
||||
if (!privateData) privateData = {};
|
||||
|
||||
privateData.wrapper = obj;
|
||||
|
||||
this._internalSetup(obj);
|
||||
Object.defineProperty(obj, impl, {
|
||||
value: new Impl.implementation(constructorArgs, privateData),
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
obj[impl][utils.wrapperSymbol] = obj;
|
||||
if (Impl.init) {
|
||||
Impl.init(obj[impl], privateData);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
interface: HTMLAudioElement,
|
||||
expose: {
|
||||
Window: { HTMLAudioElement }
|
||||
}
|
||||
}; // iface
|
||||
module.exports = iface;
|
||||
|
||||
const Impl = require("../nodes/HTMLAudioElement-impl.js");
|
135
node_modules/jsdom/lib/jsdom/living/generated/HTMLBRElement.js
generated
vendored
Normal file
135
node_modules/jsdom/lib/jsdom/living/generated/HTMLBRElement.js
generated
vendored
Normal file
|
@ -0,0 +1,135 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const impl = utils.implSymbol;
|
||||
const HTMLElement = require("./HTMLElement.js");
|
||||
|
||||
function HTMLBRElement() {
|
||||
throw new TypeError("Illegal constructor");
|
||||
}
|
||||
|
||||
Object.setPrototypeOf(HTMLBRElement.prototype, HTMLElement.interface.prototype);
|
||||
Object.setPrototypeOf(HTMLBRElement, HTMLElement.interface);
|
||||
|
||||
Object.defineProperty(HTMLBRElement, "prototype", {
|
||||
value: HTMLBRElement.prototype,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: false
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLBRElement.prototype, "clear", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
const value = this.getAttribute("clear");
|
||||
return value === null ? "" : value;
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["DOMString"](V, {
|
||||
context: "Failed to set the 'clear' property on 'HTMLBRElement': The provided value"
|
||||
});
|
||||
|
||||
this.setAttribute("clear", V);
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLBRElement.prototype, Symbol.toStringTag, {
|
||||
value: "HTMLBRElement",
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
const iface = {
|
||||
// When an interface-module that implements this interface as a mixin is loaded, it will append its own `.is()`
|
||||
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
|
||||
// implementing this mixin interface.
|
||||
_mixedIntoPredicates: [],
|
||||
is(obj) {
|
||||
if (obj) {
|
||||
if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(obj)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
isImpl(obj) {
|
||||
if (obj) {
|
||||
if (obj instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const wrapper = utils.wrapperForImpl(obj);
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(wrapper)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (module.exports.is(obj)) {
|
||||
return utils.implForWrapper(obj);
|
||||
}
|
||||
throw new TypeError(`${context} is not of type 'HTMLBRElement'.`);
|
||||
},
|
||||
|
||||
create(constructorArgs, privateData) {
|
||||
let obj = Object.create(HTMLBRElement.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return obj;
|
||||
},
|
||||
createImpl(constructorArgs, privateData) {
|
||||
let obj = Object.create(HTMLBRElement.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return utils.implForWrapper(obj);
|
||||
},
|
||||
_internalSetup(obj) {
|
||||
HTMLElement._internalSetup(obj);
|
||||
},
|
||||
setup(obj, constructorArgs, privateData) {
|
||||
if (!privateData) privateData = {};
|
||||
|
||||
privateData.wrapper = obj;
|
||||
|
||||
this._internalSetup(obj);
|
||||
Object.defineProperty(obj, impl, {
|
||||
value: new Impl.implementation(constructorArgs, privateData),
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
obj[impl][utils.wrapperSymbol] = obj;
|
||||
if (Impl.init) {
|
||||
Impl.init(obj[impl], privateData);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
interface: HTMLBRElement,
|
||||
expose: {
|
||||
Window: { HTMLBRElement }
|
||||
}
|
||||
}; // iface
|
||||
module.exports = iface;
|
||||
|
||||
const Impl = require("../nodes/HTMLBRElement-impl.js");
|
160
node_modules/jsdom/lib/jsdom/living/generated/HTMLBaseElement.js
generated
vendored
Normal file
160
node_modules/jsdom/lib/jsdom/living/generated/HTMLBaseElement.js
generated
vendored
Normal file
|
@ -0,0 +1,160 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const impl = utils.implSymbol;
|
||||
const HTMLElement = require("./HTMLElement.js");
|
||||
|
||||
function HTMLBaseElement() {
|
||||
throw new TypeError("Illegal constructor");
|
||||
}
|
||||
|
||||
Object.setPrototypeOf(HTMLBaseElement.prototype, HTMLElement.interface.prototype);
|
||||
Object.setPrototypeOf(HTMLBaseElement, HTMLElement.interface);
|
||||
|
||||
Object.defineProperty(HTMLBaseElement, "prototype", {
|
||||
value: HTMLBaseElement.prototype,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: false
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLBaseElement.prototype, "href", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["href"];
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, {
|
||||
context: "Failed to set the 'href' property on 'HTMLBaseElement': The provided value"
|
||||
});
|
||||
|
||||
this[impl]["href"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLBaseElement.prototype, "target", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
const value = this.getAttribute("target");
|
||||
return value === null ? "" : value;
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["DOMString"](V, {
|
||||
context: "Failed to set the 'target' property on 'HTMLBaseElement': The provided value"
|
||||
});
|
||||
|
||||
this.setAttribute("target", V);
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLBaseElement.prototype, Symbol.toStringTag, {
|
||||
value: "HTMLBaseElement",
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
const iface = {
|
||||
// When an interface-module that implements this interface as a mixin is loaded, it will append its own `.is()`
|
||||
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
|
||||
// implementing this mixin interface.
|
||||
_mixedIntoPredicates: [],
|
||||
is(obj) {
|
||||
if (obj) {
|
||||
if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(obj)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
isImpl(obj) {
|
||||
if (obj) {
|
||||
if (obj instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const wrapper = utils.wrapperForImpl(obj);
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(wrapper)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (module.exports.is(obj)) {
|
||||
return utils.implForWrapper(obj);
|
||||
}
|
||||
throw new TypeError(`${context} is not of type 'HTMLBaseElement'.`);
|
||||
},
|
||||
|
||||
create(constructorArgs, privateData) {
|
||||
let obj = Object.create(HTMLBaseElement.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return obj;
|
||||
},
|
||||
createImpl(constructorArgs, privateData) {
|
||||
let obj = Object.create(HTMLBaseElement.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return utils.implForWrapper(obj);
|
||||
},
|
||||
_internalSetup(obj) {
|
||||
HTMLElement._internalSetup(obj);
|
||||
},
|
||||
setup(obj, constructorArgs, privateData) {
|
||||
if (!privateData) privateData = {};
|
||||
|
||||
privateData.wrapper = obj;
|
||||
|
||||
this._internalSetup(obj);
|
||||
Object.defineProperty(obj, impl, {
|
||||
value: new Impl.implementation(constructorArgs, privateData),
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
obj[impl][utils.wrapperSymbol] = obj;
|
||||
if (Impl.init) {
|
||||
Impl.init(obj[impl], privateData);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
interface: HTMLBaseElement,
|
||||
expose: {
|
||||
Window: { HTMLBaseElement }
|
||||
}
|
||||
}; // iface
|
||||
module.exports = iface;
|
||||
|
||||
const Impl = require("../nodes/HTMLBaseElement-impl.js");
|
641
node_modules/jsdom/lib/jsdom/living/generated/HTMLBodyElement.js
generated
vendored
Normal file
641
node_modules/jsdom/lib/jsdom/living/generated/HTMLBodyElement.js
generated
vendored
Normal file
|
@ -0,0 +1,641 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const impl = utils.implSymbol;
|
||||
const HTMLElement = require("./HTMLElement.js");
|
||||
const WindowEventHandlers = require("./WindowEventHandlers.js");
|
||||
|
||||
function HTMLBodyElement() {
|
||||
throw new TypeError("Illegal constructor");
|
||||
}
|
||||
|
||||
Object.setPrototypeOf(HTMLBodyElement.prototype, HTMLElement.interface.prototype);
|
||||
Object.setPrototypeOf(HTMLBodyElement, HTMLElement.interface);
|
||||
|
||||
Object.defineProperty(HTMLBodyElement, "prototype", {
|
||||
value: HTMLBodyElement.prototype,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: false
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLBodyElement.prototype, "text", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
const value = this.getAttribute("text");
|
||||
return value === null ? "" : value;
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["DOMString"](V, {
|
||||
context: "Failed to set the 'text' property on 'HTMLBodyElement': The provided value",
|
||||
treatNullAsEmptyString: true
|
||||
});
|
||||
|
||||
this.setAttribute("text", V);
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLBodyElement.prototype, "link", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
const value = this.getAttribute("link");
|
||||
return value === null ? "" : value;
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["DOMString"](V, {
|
||||
context: "Failed to set the 'link' property on 'HTMLBodyElement': The provided value",
|
||||
treatNullAsEmptyString: true
|
||||
});
|
||||
|
||||
this.setAttribute("link", V);
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLBodyElement.prototype, "vLink", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
const value = this.getAttribute("vLink");
|
||||
return value === null ? "" : value;
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["DOMString"](V, {
|
||||
context: "Failed to set the 'vLink' property on 'HTMLBodyElement': The provided value",
|
||||
treatNullAsEmptyString: true
|
||||
});
|
||||
|
||||
this.setAttribute("vLink", V);
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLBodyElement.prototype, "aLink", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
const value = this.getAttribute("aLink");
|
||||
return value === null ? "" : value;
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["DOMString"](V, {
|
||||
context: "Failed to set the 'aLink' property on 'HTMLBodyElement': The provided value",
|
||||
treatNullAsEmptyString: true
|
||||
});
|
||||
|
||||
this.setAttribute("aLink", V);
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLBodyElement.prototype, "bgColor", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
const value = this.getAttribute("bgColor");
|
||||
return value === null ? "" : value;
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["DOMString"](V, {
|
||||
context: "Failed to set the 'bgColor' property on 'HTMLBodyElement': The provided value",
|
||||
treatNullAsEmptyString: true
|
||||
});
|
||||
|
||||
this.setAttribute("bgColor", V);
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLBodyElement.prototype, "background", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
const value = this.getAttribute("background");
|
||||
return value === null ? "" : value;
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["DOMString"](V, {
|
||||
context: "Failed to set the 'background' property on 'HTMLBodyElement': The provided value"
|
||||
});
|
||||
|
||||
this.setAttribute("background", V);
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLBodyElement.prototype, "onafterprint", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return utils.tryWrapperForImpl(this[impl]["onafterprint"]);
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = utils.tryImplForWrapper(V);
|
||||
|
||||
this[impl]["onafterprint"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLBodyElement.prototype, "onbeforeprint", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return utils.tryWrapperForImpl(this[impl]["onbeforeprint"]);
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = utils.tryImplForWrapper(V);
|
||||
|
||||
this[impl]["onbeforeprint"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLBodyElement.prototype, "onbeforeunload", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return utils.tryWrapperForImpl(this[impl]["onbeforeunload"]);
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = utils.tryImplForWrapper(V);
|
||||
|
||||
this[impl]["onbeforeunload"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLBodyElement.prototype, "onhashchange", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return utils.tryWrapperForImpl(this[impl]["onhashchange"]);
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = utils.tryImplForWrapper(V);
|
||||
|
||||
this[impl]["onhashchange"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLBodyElement.prototype, "onlanguagechange", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return utils.tryWrapperForImpl(this[impl]["onlanguagechange"]);
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = utils.tryImplForWrapper(V);
|
||||
|
||||
this[impl]["onlanguagechange"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLBodyElement.prototype, "onmessage", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return utils.tryWrapperForImpl(this[impl]["onmessage"]);
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = utils.tryImplForWrapper(V);
|
||||
|
||||
this[impl]["onmessage"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLBodyElement.prototype, "onmessageerror", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return utils.tryWrapperForImpl(this[impl]["onmessageerror"]);
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = utils.tryImplForWrapper(V);
|
||||
|
||||
this[impl]["onmessageerror"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLBodyElement.prototype, "onoffline", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return utils.tryWrapperForImpl(this[impl]["onoffline"]);
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = utils.tryImplForWrapper(V);
|
||||
|
||||
this[impl]["onoffline"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLBodyElement.prototype, "ononline", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return utils.tryWrapperForImpl(this[impl]["ononline"]);
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = utils.tryImplForWrapper(V);
|
||||
|
||||
this[impl]["ononline"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLBodyElement.prototype, "onpagehide", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return utils.tryWrapperForImpl(this[impl]["onpagehide"]);
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = utils.tryImplForWrapper(V);
|
||||
|
||||
this[impl]["onpagehide"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLBodyElement.prototype, "onpageshow", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return utils.tryWrapperForImpl(this[impl]["onpageshow"]);
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = utils.tryImplForWrapper(V);
|
||||
|
||||
this[impl]["onpageshow"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLBodyElement.prototype, "onpopstate", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return utils.tryWrapperForImpl(this[impl]["onpopstate"]);
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = utils.tryImplForWrapper(V);
|
||||
|
||||
this[impl]["onpopstate"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLBodyElement.prototype, "onrejectionhandled", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return utils.tryWrapperForImpl(this[impl]["onrejectionhandled"]);
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = utils.tryImplForWrapper(V);
|
||||
|
||||
this[impl]["onrejectionhandled"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLBodyElement.prototype, "onstorage", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return utils.tryWrapperForImpl(this[impl]["onstorage"]);
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = utils.tryImplForWrapper(V);
|
||||
|
||||
this[impl]["onstorage"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLBodyElement.prototype, "onunhandledrejection", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return utils.tryWrapperForImpl(this[impl]["onunhandledrejection"]);
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = utils.tryImplForWrapper(V);
|
||||
|
||||
this[impl]["onunhandledrejection"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLBodyElement.prototype, "onunload", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return utils.tryWrapperForImpl(this[impl]["onunload"]);
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = utils.tryImplForWrapper(V);
|
||||
|
||||
this[impl]["onunload"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLBodyElement.prototype, Symbol.toStringTag, {
|
||||
value: "HTMLBodyElement",
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
const iface = {
|
||||
// When an interface-module that implements this interface as a mixin is loaded, it will append its own `.is()`
|
||||
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
|
||||
// implementing this mixin interface.
|
||||
_mixedIntoPredicates: [],
|
||||
is(obj) {
|
||||
if (obj) {
|
||||
if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(obj)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
isImpl(obj) {
|
||||
if (obj) {
|
||||
if (obj instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const wrapper = utils.wrapperForImpl(obj);
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(wrapper)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (module.exports.is(obj)) {
|
||||
return utils.implForWrapper(obj);
|
||||
}
|
||||
throw new TypeError(`${context} is not of type 'HTMLBodyElement'.`);
|
||||
},
|
||||
|
||||
create(constructorArgs, privateData) {
|
||||
let obj = Object.create(HTMLBodyElement.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return obj;
|
||||
},
|
||||
createImpl(constructorArgs, privateData) {
|
||||
let obj = Object.create(HTMLBodyElement.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return utils.implForWrapper(obj);
|
||||
},
|
||||
_internalSetup(obj) {
|
||||
HTMLElement._internalSetup(obj);
|
||||
},
|
||||
setup(obj, constructorArgs, privateData) {
|
||||
if (!privateData) privateData = {};
|
||||
|
||||
privateData.wrapper = obj;
|
||||
|
||||
this._internalSetup(obj);
|
||||
Object.defineProperty(obj, impl, {
|
||||
value: new Impl.implementation(constructorArgs, privateData),
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
obj[impl][utils.wrapperSymbol] = obj;
|
||||
if (Impl.init) {
|
||||
Impl.init(obj[impl], privateData);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
interface: HTMLBodyElement,
|
||||
expose: {
|
||||
Window: { HTMLBodyElement }
|
||||
}
|
||||
}; // iface
|
||||
module.exports = iface;
|
||||
|
||||
WindowEventHandlers._mixedIntoPredicates.push(module.exports.is);
|
||||
|
||||
const Impl = require("../nodes/HTMLBodyElement-impl.js");
|
403
node_modules/jsdom/lib/jsdom/living/generated/HTMLButtonElement.js
generated
vendored
Normal file
403
node_modules/jsdom/lib/jsdom/living/generated/HTMLButtonElement.js
generated
vendored
Normal file
|
@ -0,0 +1,403 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const impl = utils.implSymbol;
|
||||
const HTMLElement = require("./HTMLElement.js");
|
||||
|
||||
function HTMLButtonElement() {
|
||||
throw new TypeError("Illegal constructor");
|
||||
}
|
||||
|
||||
Object.setPrototypeOf(HTMLButtonElement.prototype, HTMLElement.interface.prototype);
|
||||
Object.setPrototypeOf(HTMLButtonElement, HTMLElement.interface);
|
||||
|
||||
Object.defineProperty(HTMLButtonElement, "prototype", {
|
||||
value: HTMLButtonElement.prototype,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: false
|
||||
});
|
||||
|
||||
HTMLButtonElement.prototype.checkValidity = function checkValidity() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl].checkValidity();
|
||||
};
|
||||
|
||||
HTMLButtonElement.prototype.reportValidity = function reportValidity() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl].reportValidity();
|
||||
};
|
||||
|
||||
HTMLButtonElement.prototype.setCustomValidity = function setCustomValidity(error) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
if (arguments.length < 1) {
|
||||
throw new 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"
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
return this[impl].setCustomValidity(...args);
|
||||
};
|
||||
|
||||
Object.defineProperty(HTMLButtonElement.prototype, "autofocus", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this.hasAttribute("autofocus");
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["boolean"](V, {
|
||||
context: "Failed to set the 'autofocus' property on 'HTMLButtonElement': The provided value"
|
||||
});
|
||||
|
||||
if (V) {
|
||||
this.setAttribute("autofocus", "");
|
||||
} else {
|
||||
this.removeAttribute("autofocus");
|
||||
}
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLButtonElement.prototype, "disabled", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this.hasAttribute("disabled");
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["boolean"](V, {
|
||||
context: "Failed to set the 'disabled' property on 'HTMLButtonElement': The provided value"
|
||||
});
|
||||
|
||||
if (V) {
|
||||
this.setAttribute("disabled", "");
|
||||
} else {
|
||||
this.removeAttribute("disabled");
|
||||
}
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLButtonElement.prototype, "form", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return utils.tryWrapperForImpl(this[impl]["form"]);
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLButtonElement.prototype, "formNoValidate", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this.hasAttribute("formNoValidate");
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["boolean"](V, {
|
||||
context: "Failed to set the 'formNoValidate' property on 'HTMLButtonElement': The provided value"
|
||||
});
|
||||
|
||||
if (V) {
|
||||
this.setAttribute("formNoValidate", "");
|
||||
} else {
|
||||
this.removeAttribute("formNoValidate");
|
||||
}
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLButtonElement.prototype, "formTarget", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
const value = this.getAttribute("formTarget");
|
||||
return value === null ? "" : value;
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["DOMString"](V, {
|
||||
context: "Failed to set the 'formTarget' property on 'HTMLButtonElement': The provided value"
|
||||
});
|
||||
|
||||
this.setAttribute("formTarget", V);
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLButtonElement.prototype, "name", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
const value = this.getAttribute("name");
|
||||
return value === null ? "" : value;
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["DOMString"](V, {
|
||||
context: "Failed to set the 'name' property on 'HTMLButtonElement': The provided value"
|
||||
});
|
||||
|
||||
this.setAttribute("name", V);
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLButtonElement.prototype, "type", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["type"];
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["DOMString"](V, {
|
||||
context: "Failed to set the 'type' property on 'HTMLButtonElement': The provided value"
|
||||
});
|
||||
|
||||
this[impl]["type"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLButtonElement.prototype, "value", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
const value = this.getAttribute("value");
|
||||
return value === null ? "" : value;
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["DOMString"](V, {
|
||||
context: "Failed to set the 'value' property on 'HTMLButtonElement': The provided value"
|
||||
});
|
||||
|
||||
this.setAttribute("value", V);
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLButtonElement.prototype, "willValidate", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["willValidate"];
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLButtonElement.prototype, "validity", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return utils.tryWrapperForImpl(this[impl]["validity"]);
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLButtonElement.prototype, "validationMessage", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["validationMessage"];
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLButtonElement.prototype, "labels", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return utils.tryWrapperForImpl(this[impl]["labels"]);
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLButtonElement.prototype, Symbol.toStringTag, {
|
||||
value: "HTMLButtonElement",
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
const iface = {
|
||||
// When an interface-module that implements this interface as a mixin is loaded, it will append its own `.is()`
|
||||
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
|
||||
// implementing this mixin interface.
|
||||
_mixedIntoPredicates: [],
|
||||
is(obj) {
|
||||
if (obj) {
|
||||
if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(obj)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
isImpl(obj) {
|
||||
if (obj) {
|
||||
if (obj instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const wrapper = utils.wrapperForImpl(obj);
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(wrapper)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (module.exports.is(obj)) {
|
||||
return utils.implForWrapper(obj);
|
||||
}
|
||||
throw new TypeError(`${context} is not of type 'HTMLButtonElement'.`);
|
||||
},
|
||||
|
||||
create(constructorArgs, privateData) {
|
||||
let obj = Object.create(HTMLButtonElement.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return obj;
|
||||
},
|
||||
createImpl(constructorArgs, privateData) {
|
||||
let obj = Object.create(HTMLButtonElement.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return utils.implForWrapper(obj);
|
||||
},
|
||||
_internalSetup(obj) {
|
||||
HTMLElement._internalSetup(obj);
|
||||
},
|
||||
setup(obj, constructorArgs, privateData) {
|
||||
if (!privateData) privateData = {};
|
||||
|
||||
privateData.wrapper = obj;
|
||||
|
||||
this._internalSetup(obj);
|
||||
Object.defineProperty(obj, impl, {
|
||||
value: new Impl.implementation(constructorArgs, privateData),
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
obj[impl][utils.wrapperSymbol] = obj;
|
||||
if (Impl.init) {
|
||||
Impl.init(obj[impl], privateData);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
interface: HTMLButtonElement,
|
||||
expose: {
|
||||
Window: { HTMLButtonElement }
|
||||
}
|
||||
}; // iface
|
||||
module.exports = iface;
|
||||
|
||||
const Impl = require("../nodes/HTMLButtonElement-impl.js");
|
254
node_modules/jsdom/lib/jsdom/living/generated/HTMLCanvasElement.js
generated
vendored
Normal file
254
node_modules/jsdom/lib/jsdom/living/generated/HTMLCanvasElement.js
generated
vendored
Normal file
|
@ -0,0 +1,254 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const impl = utils.implSymbol;
|
||||
const HTMLElement = require("./HTMLElement.js");
|
||||
|
||||
function HTMLCanvasElement() {
|
||||
throw new TypeError("Illegal constructor");
|
||||
}
|
||||
|
||||
Object.setPrototypeOf(HTMLCanvasElement.prototype, HTMLElement.interface.prototype);
|
||||
Object.setPrototypeOf(HTMLCanvasElement, HTMLElement.interface);
|
||||
|
||||
Object.defineProperty(HTMLCanvasElement, "prototype", {
|
||||
value: HTMLCanvasElement.prototype,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: false
|
||||
});
|
||||
|
||||
HTMLCanvasElement.prototype.getContext = function getContext(contextId) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
if (arguments.length < 1) {
|
||||
throw new 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"
|
||||
});
|
||||
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)
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
return utils.tryWrapperForImpl(this[impl].getContext(...args));
|
||||
};
|
||||
|
||||
HTMLCanvasElement.prototype.toDataURL = function toDataURL() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
const args = [];
|
||||
{
|
||||
let curArg = arguments[0];
|
||||
if (curArg !== undefined) {
|
||||
curArg = conversions["DOMString"](curArg, {
|
||||
context: "Failed to execute 'toDataURL' on 'HTMLCanvasElement': parameter 1"
|
||||
});
|
||||
}
|
||||
args.push(curArg);
|
||||
}
|
||||
{
|
||||
let curArg = arguments[1];
|
||||
if (curArg !== undefined) {
|
||||
curArg = conversions["any"](curArg, {
|
||||
context: "Failed to execute 'toDataURL' on 'HTMLCanvasElement': parameter 2"
|
||||
});
|
||||
}
|
||||
args.push(curArg);
|
||||
}
|
||||
return this[impl].toDataURL(...args);
|
||||
};
|
||||
|
||||
HTMLCanvasElement.prototype.toBlob = function toBlob(callback) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
if (arguments.length < 1) {
|
||||
throw new TypeError(
|
||||
"Failed to execute 'toBlob' on 'HTMLCanvasElement': 1 argument required, but only " +
|
||||
arguments.length +
|
||||
" present."
|
||||
);
|
||||
}
|
||||
const args = [];
|
||||
{
|
||||
let curArg = arguments[0];
|
||||
curArg = utils.tryImplForWrapper(curArg);
|
||||
args.push(curArg);
|
||||
}
|
||||
{
|
||||
let curArg = arguments[1];
|
||||
if (curArg !== undefined) {
|
||||
curArg = conversions["DOMString"](curArg, {
|
||||
context: "Failed to execute 'toBlob' on 'HTMLCanvasElement': parameter 2"
|
||||
});
|
||||
}
|
||||
args.push(curArg);
|
||||
}
|
||||
{
|
||||
let curArg = arguments[2];
|
||||
if (curArg !== undefined) {
|
||||
curArg = conversions["any"](curArg, {
|
||||
context: "Failed to execute 'toBlob' on 'HTMLCanvasElement': parameter 3"
|
||||
});
|
||||
}
|
||||
args.push(curArg);
|
||||
}
|
||||
return this[impl].toBlob(...args);
|
||||
};
|
||||
|
||||
Object.defineProperty(HTMLCanvasElement.prototype, "width", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["width"];
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["unsigned long"](V, {
|
||||
context: "Failed to set the 'width' property on 'HTMLCanvasElement': The provided value"
|
||||
});
|
||||
|
||||
this[impl]["width"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLCanvasElement.prototype, "height", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["height"];
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["unsigned long"](V, {
|
||||
context: "Failed to set the 'height' property on 'HTMLCanvasElement': The provided value"
|
||||
});
|
||||
|
||||
this[impl]["height"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLCanvasElement.prototype, Symbol.toStringTag, {
|
||||
value: "HTMLCanvasElement",
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
const iface = {
|
||||
// When an interface-module that implements this interface as a mixin is loaded, it will append its own `.is()`
|
||||
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
|
||||
// implementing this mixin interface.
|
||||
_mixedIntoPredicates: [],
|
||||
is(obj) {
|
||||
if (obj) {
|
||||
if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(obj)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
isImpl(obj) {
|
||||
if (obj) {
|
||||
if (obj instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const wrapper = utils.wrapperForImpl(obj);
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(wrapper)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (module.exports.is(obj)) {
|
||||
return utils.implForWrapper(obj);
|
||||
}
|
||||
throw new TypeError(`${context} is not of type 'HTMLCanvasElement'.`);
|
||||
},
|
||||
|
||||
create(constructorArgs, privateData) {
|
||||
let obj = Object.create(HTMLCanvasElement.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return obj;
|
||||
},
|
||||
createImpl(constructorArgs, privateData) {
|
||||
let obj = Object.create(HTMLCanvasElement.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return utils.implForWrapper(obj);
|
||||
},
|
||||
_internalSetup(obj) {
|
||||
HTMLElement._internalSetup(obj);
|
||||
},
|
||||
setup(obj, constructorArgs, privateData) {
|
||||
if (!privateData) privateData = {};
|
||||
|
||||
privateData.wrapper = obj;
|
||||
|
||||
this._internalSetup(obj);
|
||||
Object.defineProperty(obj, impl, {
|
||||
value: new Impl.implementation(constructorArgs, privateData),
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
obj[impl][utils.wrapperSymbol] = obj;
|
||||
if (Impl.init) {
|
||||
Impl.init(obj[impl], privateData);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
interface: HTMLCanvasElement,
|
||||
expose: {
|
||||
Window: { HTMLCanvasElement }
|
||||
}
|
||||
}; // iface
|
||||
module.exports = iface;
|
||||
|
||||
const Impl = require("../nodes/HTMLCanvasElement-impl.js");
|
353
node_modules/jsdom/lib/jsdom/living/generated/HTMLCollection.js
generated
vendored
Normal file
353
node_modules/jsdom/lib/jsdom/living/generated/HTMLCollection.js
generated
vendored
Normal file
|
@ -0,0 +1,353 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const impl = utils.implSymbol;
|
||||
|
||||
function HTMLCollection() {
|
||||
throw new TypeError("Illegal constructor");
|
||||
}
|
||||
|
||||
Object.defineProperty(HTMLCollection, "prototype", {
|
||||
value: HTMLCollection.prototype,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: false
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLCollection.prototype, Symbol.iterator, {
|
||||
writable: true,
|
||||
enumerable: false,
|
||||
configurable: true,
|
||||
value: Array.prototype[Symbol.iterator]
|
||||
});
|
||||
|
||||
HTMLCollection.prototype.item = function item(index) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
if (arguments.length < 1) {
|
||||
throw new 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"
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
return utils.tryWrapperForImpl(this[impl].item(...args));
|
||||
};
|
||||
|
||||
HTMLCollection.prototype.namedItem = function namedItem(name) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
if (arguments.length < 1) {
|
||||
throw new 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"
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
return utils.tryWrapperForImpl(this[impl].namedItem(...args));
|
||||
};
|
||||
|
||||
Object.defineProperty(HTMLCollection.prototype, "length", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["length"];
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(HTMLCollection.prototype, Symbol.toStringTag, {
|
||||
value: "HTMLCollection",
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
const iface = {
|
||||
// When an interface-module that implements this interface as a mixin is loaded, it will append its own `.is()`
|
||||
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
|
||||
// implementing this mixin interface.
|
||||
_mixedIntoPredicates: [],
|
||||
is(obj) {
|
||||
if (obj) {
|
||||
if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(obj)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
isImpl(obj) {
|
||||
if (obj) {
|
||||
if (obj instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const wrapper = utils.wrapperForImpl(obj);
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(wrapper)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (module.exports.is(obj)) {
|
||||
return utils.implForWrapper(obj);
|
||||
}
|
||||
throw new TypeError(`${context} is not of type 'HTMLCollection'.`);
|
||||
},
|
||||
|
||||
create(constructorArgs, privateData) {
|
||||
let obj = Object.create(HTMLCollection.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return obj;
|
||||
},
|
||||
createImpl(constructorArgs, privateData) {
|
||||
let obj = Object.create(HTMLCollection.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return utils.implForWrapper(obj);
|
||||
},
|
||||
_internalSetup(obj) {},
|
||||
setup(obj, constructorArgs, privateData) {
|
||||
if (!privateData) privateData = {};
|
||||
|
||||
privateData.wrapper = obj;
|
||||
|
||||
this._internalSetup(obj);
|
||||
Object.defineProperty(obj, impl, {
|
||||
value: new Impl.implementation(constructorArgs, privateData),
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
obj = new Proxy(obj, {
|
||||
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[impl][utils.supportedPropertyIndices]) {
|
||||
keys.add(`${key}`);
|
||||
}
|
||||
|
||||
for (const key of target[impl][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[impl].item(index);
|
||||
if (indexedValue !== null) {
|
||||
return {
|
||||
writable: false,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
value: utils.tryWrapperForImpl(indexedValue)
|
||||
};
|
||||
}
|
||||
ignoreNamedProps = true;
|
||||
}
|
||||
|
||||
const namedValue = target[impl].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);
|
||||
}
|
||||
if (target === receiver) {
|
||||
utils.isArrayIndexPropName(P);
|
||||
|
||||
typeof P === "string" && !utils.isArrayIndexPropName(P);
|
||||
}
|
||||
let ownDesc;
|
||||
|
||||
if (utils.isArrayIndexPropName(P)) {
|
||||
const index = P >>> 0;
|
||||
const indexedValue = target[impl].item(index);
|
||||
if (indexedValue !== null) {
|
||||
ownDesc = {
|
||||
writable: false,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
value: utils.tryWrapperForImpl(indexedValue)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
if (ownDesc === undefined) {
|
||||
ownDesc = Reflect.getOwnPropertyDescriptor(target, P);
|
||||
}
|
||||
if (ownDesc === undefined) {
|
||||
const parent = Reflect.getPrototypeOf(target);
|
||||
if (parent !== null) {
|
||||
return Reflect.set(parent, P, V, receiver);
|
||||
}
|
||||
ownDesc = { writable: true, enumerable: true, configurable: true, value: undefined };
|
||||
}
|
||||
if (!ownDesc.writable) {
|
||||
return false;
|
||||
}
|
||||
if (!utils.isObject(receiver)) {
|
||||
return false;
|
||||
}
|
||||
const existingDesc = Reflect.getOwnPropertyDescriptor(receiver, P);
|
||||
let valueDesc;
|
||||
if (existingDesc !== undefined) {
|
||||
if (existingDesc.get || existingDesc.set) {
|
||||
return false;
|
||||
}
|
||||
if (!existingDesc.writable) {
|
||||
return false;
|
||||
}
|
||||
valueDesc = { value: V };
|
||||
} else {
|
||||
valueDesc = { writable: true, enumerable: true, configurable: true, value: V };
|
||||
}
|
||||
return Reflect.defineProperty(receiver, P, valueDesc);
|
||||
},
|
||||
|
||||
defineProperty(target, P, desc) {
|
||||
if (typeof P === "symbol") {
|
||||
return Reflect.defineProperty(target, P, desc);
|
||||
}
|
||||
|
||||
if (utils.isArrayIndexPropName(P)) {
|
||||
return false;
|
||||
}
|
||||
if (!utils.hasOwn(target, P)) {
|
||||
const creating = !(target[impl].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);
|
||||
}
|
||||
|
||||
if (utils.isArrayIndexPropName(P)) {
|
||||
const index = P >>> 0;
|
||||
return !(target[impl].item(index) !== null);
|
||||
}
|
||||
|
||||
if (target[impl].namedItem(P) !== null && !(P in target)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return Reflect.deleteProperty(target, P);
|
||||
},
|
||||
|
||||
preventExtensions() {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
obj[impl][utils.wrapperSymbol] = obj;
|
||||
if (Impl.init) {
|
||||
Impl.init(obj[impl], privateData);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
interface: HTMLCollection,
|
||||
expose: {
|
||||
Window: { HTMLCollection }
|
||||
}
|
||||
}; // iface
|
||||
module.exports = iface;
|
||||
|
||||
const Impl = require("../nodes/HTMLCollection-impl.js");
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue