1
0
mirror of https://github.com/S2-/minifyfromhtml.git synced 2025-08-02 20:00:05 +02:00

update node modules

This commit is contained in:
s2
2019-03-29 15:56:41 +01:00
parent f114871153
commit 89c32fb4e6
8347 changed files with 390123 additions and 159877 deletions

181
node_modules/jsdom/Changelog.md generated vendored
View File

@@ -1,3 +1,158 @@
<!-- Style guide:
* Use past tense verbs to start the sentence, e.g. "Fixed", "Added", "Removed", ...
* Each bullet point is a sentence (or more), and so ends with a period.
* Package names are in `code`, sometimes [`linked`]().
* Prefer referring to methods and properties via `someInstance.prop`, instead of `ClassName.prototype.prop`. (Never use `ClassName.prop` except for statics.)
* Refer to attributes via `attr=""`.
* Refer to elements via `<element>`.
* Never use the IDL terms "interface", "attribute", or "operation".
* URL schemes are in `code`, e.g. `data:`.
* Except in the headings, all version numbers get a "v" prefix, e.g. v12.2.0.
* Follow the bullet point with parenthetical GitHub usernames when contributed by a non-core team member, e.g. "Fixed foo. (person)"
Other guidelines:
* Commit messages are primarily for jsdom developers. Changelog entries are primarily for users. Usually you cannot reuse the commit message.
* Sometimes a single commit may expand to multiple changelog entries.
* Do not include commits that have no user-facing impact, e.g. test rolls, refactorings, benchmark additions, etc.
* For regression fixes, note the version in which something regressed.
* Breaking changes get their own section.
* Group in the order "Added", "Removed", "Changed", "Fixed".
* Roughly order changes within those groupings by impact.
-->
## 14.0.0
Breaking changes:
* `JSDOM.fragment()` now creates fragments whose document has no [browsing context](https://html.spec.whatwg.org/multipage/#concept-document-bc), i.e. no associated `Window`. This means the `defaultView` property will be null, resources will not load, etc.
* `JSDOM.fragment()`, called with no arguments, now creates a `DocumentFragment` with no children, instead of with a single child text node whose data was `"undefined"`.
Other changes:
* Fixed a regression in v13.2.0 when calling `element.blur()` on a focused element.
* Fixed inserting `<link>` elements into documents with no browsing context to no longer crash if the originating `JSDOM` was configured to fetch the resource. Now, per spec, `<link>` elements only attempt to fetch if they are browsing-context connected.
* Fixed `<template>` elements to have the correct semantics, of using a separate browsing-context-less document to store its contents. In particular this means resources will not be fetched for elements inside the `<template>`, as per spec.
## 13.2.0
* Added support for `MutationObserver`s! (pmdartus)
* Added support for XML documents loaded in frames and iframes; previously this would error.
* Added the `<progress>` element's `value`, `max`, and `position` properties.
* Added `navigator.plugins` and `navigator.mimeTypes`. (But, they are always empty.)
* Fixed `<summary>` elements respond to click events by toggling their parent `<details>`.
* Fixed `<summary>` elements to be focusable.
* Fixed XML document DOCTYPE parsing to preserve any custom name values.
* Fixed XML documents to default to UTF-8, not windows-1252 like HTML documents do.
* Fixed all events fired by jsdom to have `isTrusted` set to `true`.
* Fixed `DOMParser`-created documents to have their `readyState` set to `"complete"`.
* Fixed how nested `<fieldset>`s get disabled.
* Fixed `getComputedStyle()` to throw a sensible exception when passed the wrong argument, instead of one that exposes jsdom internals.
* Upgraded our [`saxes`](https://github.com/lddubeau/saxes) dependency, so that it now correctly errors on XML fragments like `<foo bar:="1"/>`.
## 13.1.0
* Added `el.insertAdjacentElement()` and `el.insertAdjacentText()`.
* Added the firing of a cancelable `"reset"` event to `form.reset()`. (epfremmer)
* Added the `type`, `value`, and `defaultValue` properties to `<output>` elements, including their form reset behavior. (epfremmer)
* Added the `outputEl.htmlFor` property.
* Fixed the performance of parsing large text nodes, particularly noticeable for large inline `<style>` or `<script>` elements. This regressed in v11.6.0. To learn more, see [V8 issue #6730](https://bugs.chromium.org/p/v8/issues/detail?id=6730#c4).
* Fixed the `style` property on `<a>` and `<area>` elements. This regressed in v13.0.0.
* Fixed `node.isConnected` to not always return false for nodes inside a shadow tree. (pmdartus)
* Fixed `<button type="reset">` and `<input type="reset">` elements to actually perform a form reset when clicked, instead of doing nothing. (epfremmer)
* Fixed `el.setCustomValidity()` for `<output>` and `<fieldset>`.
* Fixed activation behavior when dispatching bubbling click events, so that for example calling `el.click()` on the child of a submit button element will submit the form.
* Fixed our XML parsing code to ignore text outside the root element, instead of treating it as an error. (lddubeau)
* Fixed XML serialization when elements had an unknown prefix.
* Fixed radio button group name matching to be case-sensitive, per [a spec update](https://github.com/whatwg/html/commit/6acdb2122298d2bb7bb839c0a61b4e1f9b0f9bc9).
* Fixed `"focus"`/`"blur"` events to be composed.
* Fixed `mediaElement.duration` to default to `NaN`.
* Fixed `olEl.start` to default to `1`.
* Fixed using `XMLHttpRequest` against non-existant `file:` URLs to treat that as a network error, instead of crashing. (pascalbayer) Note that in the future we may completely disable `XMLHttpRequest` usage against `file:` URLs to follow the browser security model.
* Fixed `document.title` in SVG documents.
* Fixed `titleElement.text` to return the child text content, instead of being the same as `titleElement.innerHTML`.
* Fixed `<textarea>`s to properly account for child CDATA section nodes changing.
* Fixed the value of `Element.prototype[Symbol.unscopables]`.
## 13.0.0
Breaking change:
* Removed support for v1.x of the [`canvas`](https://github.com/Automattic/node-canvas) package, in favor of v2.x. This also removes support for `canvas-prebuilt`, since `canvas` v2.x has a built-in prebuilt version.
Other changes:
* Added proper XML serialization, based on the [`w3c-xmlserializer`](https://github.com/jsdom/w3c-xmlserializer) package. Previously we were just using the HTML serialization, even in XML documents.
* Added the `storageEvent.initStorageEvent()` method.
* Added support for the `passive` option to `addEventListener()`.
* Added the `relList` property to `<a>`, `<area>`, and `<link>` elements.
* Fixed our implementation of the node tree modification constraints (for example the [ensure pre-insertion validity](https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity) algorithm). It is no longer possible to add, remove, or move nodes to create impossible DOM trees. (pmdartus)
## 12.2.0
* Added support for shadow DOM! This includes shadow roots, slots, composed events, and more. (pmdartus)
* Added the `element.toggleAttribute()` method.
* Fixed `XMLHttpRequest` sometimes sending an empty request body after a preflight request. (andreasf)
* Fixed the `formElement.form` property to use an algorithm that also checks the `form=""` attribute, instead of always looking for the closest ancestor `<form>` element. (jamietre)
* Stopped swallowing errors when the `canvas` or `canvas-prebuilt` packages were installed, but failed to load. (joscha)
## 12.1.0
* Dramatically upgraded our XML parser, from the unmaintained [`sax`](https://github.com/isaacs/sax-js) package to the well-maintained [`saxes`](https://github.com/lddubeau/saxes) replacement. This increases our specification conformance, including rejecting certain ill-formed XML documents that were previously accepted, and properly handling other constructs like empty comments, CDATA sections, and `<script>` elements. (lddubeau)
* Added `fieldsetEl.elements` and `fieldsetEl.type` properties.
* Added the `options` parameter to `dom.runVMScript()`. (SimenB)
* Added the ability for custom resource loader `fetch()` implementations to see what element initiated the fetch. (sarvaje)
* Fixed `input` and `change` events for `<input>` elements to be trusted and uncancelable.
* "Fixed" `<script>`s with the `async` attribute to not execute before sync `<script>`s that precede them. We still do not, in general, have proper execution of scripts during the initial parsing of a document, so this fix is more of a reduction of badness than an alignment with the specification. This behavior regressed in v12.0.0. (sarvaje)
## 12.0.0
This major release brings along our [new resource loader API](https://github.com/jsdom/jsdom#loading-subresources), finally bringing all the capabilities from jsdom v9 to the new (jsdom v10+) API. Thanks very much to [@sarvaje](https://github.com/sarvaje) for his work to make this possible!
Breaking changes:
* jsdom now requires Node.js v8.
* Removed the old jsdom API, as the new API now has all the capabilities you need.
* Updated our [`parse5`](https://github.com/inikulin/parse5/) dependency to v5, which changes the format of the node locations returned by `dom.nodeLocation()`.
* Updated our [`whatwg-url`](https://github.com/jsdom/whatwg-url) dependency to v7, which changes the origin of `file:` URLs to be an opaque origin (and thus `file:` URLs are no longer same origin to each other).
Other changes:
* Added `countReset()`, `dir()` and `dirxml()` methods to `console`.
* Added the `InputEvent` class.
* Added `window.status`.
* Added `htmlElement.draggable`.
* Fixed `window.frameElement` to correctly return an actual `HTMLElement` instance, instead of a jsdom internal class.
* Fixed cloning of `textarea` elements to preserve their values.
* Fixed `select.selectedOptions` sometimes returning outdated results.
* Fixed CSS selection APIs sometimes returning outdated results, especially for state pseudo-class selectors like `:checked`.
* Fixed CSS selection APIs to throw an error for invalid selectors even when used on empty nodes.
* Fixed `window.name` to default to the empty string, per spec, instead of `"nodejs"`.
* Fixed the default User-Agent to say "unknown OS" instead of "undefined" when jsdom is used in web browsers.
## 11.12.0
* Added `window.localStorage`, `window.sessionStorage`, and `StorageEvent` support. These are currently only stored in-memory; file an issue if you need persistent (on-disk) storage capability so we can discuss adding that. This feature includes the new `storageQuota` option for controlling how much can be stored.
* Added `element.closest()`. (caub)
* Changed `"hashchange"` and `"popstate"` events to no longer bubble, per a specification update.
* Fixed the old API in Node.js v10 to not throw, when given input that is not a valid file path (such as a typical HTML string).
* Upgraded `cssstyle` to v1.0.0, bringing along various fixes to our CSS parser and object model. (eddies)
* Upgraded `nwsapi` to v2.0.7, bringing along various fixes to our selector engine.
## 11.11.0
* Added `node.getRootNode()`. (FrecksterGIT)
* Added `label.control`. (FrecksterGIT)
* Added `el.labels` for form control elements. (FrecksterGIT)
* Fixed the `contentType` of `Document`s created through `<iframe>`s.
* Fixed the `contentType` and `origin` of `Document`s created through `document.implementation.createDocument()`.
* Fixed `sourceEl.srcset` to return the value of the `srcset=""` attribute, instead of the `cite=""` attribute.
* Fixed `node.normalize()` to not modify non-`Text` nodes. (lddubeau)
* Upgraded `cssstyle` to v0.3.1, bringing along various fixes to our CSS parser and object model. (jsakas)
* Upgraded `whatwg-url` to v6.4.1, fixing the interaction of `URL`'s `href` and `searchParams` properties.
* Upgraded our selector matching engine from `nwsmatcher` to `nwsapi`, bringing along extensive fixes, performance improvements, and additional selector support.
## 11.10.0
* Added `event.srcElement` and `event.returnValue`.
@@ -6,7 +161,7 @@
## 11.9.0
* Added `node.lookupPrefix()`, `node.lookupNamespaceURI()` and `node.isDefaultNamespace()`.
* Fixed the cloning of `Document`s; previously it would not clone all of the appropriate state, and wouuld sometimes add an extra document type node.
* Fixed the cloning of `Document`s; previously it would not clone all of the appropriate state, and would sometimes add an extra document type node.
* Fixed various edge cases in the `textContent` and `nodeValue` properties.
* Fixed `canvas.toBlob()` to properly pass through the JPEG quality argument, instead of always passing zero to `node-canvas`. (challakoushik)
@@ -23,8 +178,8 @@
* Fixed an exception that would sometimes get raised when removing an `<img>` element's `src=""` attribute. (atsikov)
* Fixed `"abort"` events on `AbortSignal`s to have their `isTrusted` set to true.
* Fixed some argument conversions in `XMLHttpRequest`'s `open()` method.
* Improved MIME type and data: URL parsing throughout jsdom, by using the new [`whatwg-mimetype`](https://www.npmjs.com/package/whatwg-mimetype) and [`data-urls`](https://www.npmjs.com/package/data-urls) packages.
* Removed some unnnecessary `.webidl` files that were included in the npm package.
* Improved MIME type and `data:` URL parsing throughout jsdom, by using the new [`whatwg-mimetype`](https://www.npmjs.com/package/whatwg-mimetype) and [`data-urls`](https://www.npmjs.com/package/data-urls) packages.
* Removed some unnecessary `.webidl` files that were included in the npm package.
## 11.6.2
@@ -271,7 +426,7 @@ Apart from the new API, the following changes were made, with breaking changes b
* Added the `blob.isClosed` property. (TimothyGu)
* Fixed the `file.lastModified` property to be on `File` instead of on `Blob`. (TimothyGu)
* Fixed the `file.lastModified` property to default to the time of the `File` object's creation, not the time that the property is accessed. (TimothyGu)
* Fixed a minor edge-case regression where non-HTML elements with the name `"iframe"` became focusable in 9.7.0.
* Fixed a minor edge-case regression where non-HTML elements with the name `"iframe"` became focusable in v9.7.0.
## 9.7.1
@@ -301,11 +456,11 @@ Apart from the new API, the following changes were made, with breaking changes b
## 9.4.5
* Fixed `"error"` events from failed resource loads going missing since 9.4.3. I really should have tested that release better.
* Fixed `"error"` events from failed resource loads going missing since v9.4.3. I really should have tested that release better.
## 9.4.4
* Fixed a leftover `console.log` introduced in the error handling path in 9.4.3.
* Fixed a leftover `console.log` introduced in the error handling path in v9.4.3.
## 9.4.3
@@ -378,7 +533,7 @@ Apart from the new API, the following changes were made, with breaking changes b
* Fixed `formEl.action` to return a value resolved relative to the document URL, or to return the document URL if the corresponding attribute is missing or empty.
* Sped up XPath execution. (vsemozhetbyt)
* Fixed `window.close()` not correctly clearing event listeners on the document. (Ojek)
* Fixed a regression introduced in 9.0.0 where invalid CSS would cause a crash while attempting to parse it. Instead, a `"jsdomError"` will now be emitted to the virtual console.
* Fixed a regression introduced in v9.0.0 where invalid CSS would cause a crash while attempting to parse it. Instead, a `"jsdomError"` will now be emitted to the virtual console.
## 9.0.0
@@ -416,7 +571,7 @@ Your normal change log follows:
## 8.4.0
* Added an implementation of the `TreeWalker` class (and `document.createTreeWalker`). (garycourt)
* Fixed a few minor bugs in URL parsing and the `URL` API, by upgrading to `whatwg-url` 2.0.1.
* Fixed a few minor bugs in URL parsing and the `URL` API, by upgrading to `whatwg-url` v2.0.1.
* Fixed a few issues with generated files in the published package, which seem to have impacted webpack users.
## 8.3.1
@@ -430,7 +585,7 @@ Your normal change log follows:
* `load` and `error` events will fire on the `<img>` element, according to how well image decoding goes.
* You can draw images onto canvases, using the newly-enabled `canvasContext.drawImage` API.
* Added `canvasContext.createPattern` and `canvasContext.toBlob`, when the `canvas` npm package is installed. (lehni)
* Added a basic implementation of the [Page Visibility API](https://w3c.github.io/page-visibility/), in particular a `document.hidden` property that always returns `true`, and a `document.visibilityState` property that always returns `"prerender"`. This is a more standard alternative to our proprietary `navigator.noUI`, which will be removed whenever we release 9.0.0. (kapouer)
* Added a basic implementation of the [Page Visibility API](https://w3c.github.io/page-visibility/), in particular a `document.hidden` property that always returns `true`, and a `document.visibilityState` property that always returns `"prerender"`. This is a more standard alternative to our proprietary `navigator.noUI`, which will be removed whenever we release v9.0.0. (kapouer)
## 8.2.0
@@ -665,9 +820,9 @@ Finally, if you're a loyal jsdom fan whose made it this far into the changelog,
## 5.6.1
* Fixed an accidentally-created global `attribute` variable if you ever called `createAttributeNS`.
* Dependency upgrades fixed a couple of bugs, although you would have gotten these anyway with a clean jsdom 5.6.0 install:
- Parsing of CSS properties that use `url("quoted string")` now works correctly, as of `cssstyle` 0.2.29.
- Selectors for the empty string, like `div[title=""]`, now work correctly, as of `nwmatcher` 1.3.6.
* Dependency upgrades fixed a couple of bugs, although you would have gotten these anyway with a clean jsdom v5.6.0 install:
- Parsing of CSS properties that use `url("quoted string")` now works correctly, as of `cssstyle` v0.2.29.
- Selectors for the empty string, like `div[title=""]`, now work correctly, as of `nwmatcher` v1.3.6.
## 5.6.0
@@ -698,7 +853,7 @@ Additionally, Joris-van-der-Wel added [a benchmarking framework](https://github.
## 5.4.1
* Fixed to work with browserify again (regression introduced in 5.4.0).
* Fixed to work with browserify again (regression introduced in v5.4.0).
## 5.4.0

102
node_modules/jsdom/README.md generated vendored
View File

@@ -5,9 +5,7 @@
jsdom is a pure-JavaScript implementation of many web standards, notably the WHATWG [DOM](https://dom.spec.whatwg.org/) and [HTML](https://html.spec.whatwg.org/multipage/) Standards, for use with Node.js. In general, the goal of the project is to emulate enough of a subset of a web browser to be useful for testing and scraping real-world web applications.
The latest versions of jsdom require Node.js v6 or newer. (Versions of jsdom below v10 still work with Node.js v4, but are unsupported.)
As of v10, jsdom has a new API (documented below). The old API is still supported for now; [see its documentation](./lib/old-api.md) for details.
The latest versions of jsdom require Node.js v8 or newer. (Versions of jsdom below v12 still work with Node.js v6, but are unsupported.)
## Basic usage
@@ -25,7 +23,7 @@ console.log(dom.window.document.querySelector("p").textContent); // "Hello world
(Note that jsdom will parse the HTML you pass it just like a browser does, including implied `<html>`, `<head>`, and `<body>` tags.)
The resulting object is an instance of the `JSDOM` class, which contains a number of useful properties and methods besides `window`. In general it can be used to act on the jsdom from the "outside," doing things that are not possible with the normal DOM APIs. For simple cases, where you don't need any of this functionality, we recommend a coding pattern like
The resulting object is an instance of the `JSDOM` class, which contains a number of useful properties and methods besides `window`. In general, it can be used to act on the jsdom from the "outside," doing things that are not possible with the normal DOM APIs. For simple cases, where you don't need any of this functionality, we recommend a coding pattern like
```js
const { window } = new JSDOM(`...`);
@@ -35,6 +33,8 @@ const { document } = (new JSDOM(`...`)).window;
Full documentation on everything you can do with the `JSDOM` class is below, in the section "`JSDOM` Object API".
_Important note: in the default configuration, JavaScript globals like `window.Date` or `window.Map` will not exist. Read the "Executing scripts" section below for more._
## Customizing jsdom
The `JSDOM` constructor accepts a second parameter which can be used to customize your jsdom in the following ways.
@@ -46,16 +46,16 @@ const dom = new JSDOM(``, {
url: "https://example.org/",
referrer: "https://example.com/",
contentType: "text/html",
userAgent: "Mellblomenator/9000",
includeNodeLocations: true
includeNodeLocations: true,
storageQuota: 10000000
});
```
- `url` sets the value returned by `window.location`, `document.URL`, and `document.documentURI`, and affects things like resolution of relative URLs within the document and the same-origin restrictions and referrer used while fetching subresources. It defaults to `"about:blank"`.
- `referrer` just affects the value read from `document.referrer`. It defaults to no referrer (which reflects as the empty string).
- `contentType` affects the value read from `document.contentType`, and how the document is parsed: as HTML or as XML. Values that are not `"text/html"` or an [XML mime type](https://html.spec.whatwg.org/multipage/infrastructure.html#xml-mime-type) will throw. It defaults to `"text/html"`.
- `userAgent` affects the value read from `navigator.userAgent`, as well as the `User-Agent` header sent while fetching subresources. It defaults to <code>\`Mozilla/5.0 (${process.platform}) AppleWebKit/537.36 (KHTML, like Gecko) jsdom/${jsdomVersion}\`</code>.
- `includeNodeLocations` preserves the location info produced by the HTML parser, allowing you to retrieve it with the `nodeLocation()` method (described below). It also ensures that line numbers reported in exception stack traces for code running inside `<script>` elements are correct. It defaults to `false` to give the best performance, and cannot be used with an XML content type since our XML parser does not support location info.
- `storageQuota` is the maximum size in code units for the separate storage areas used by `localStorage` and `sessionStorage`. Attempts to store data larger than this limit will cause a `DOMException` to be thrown. By default, it is set to 5,000,000 code units per origin, as inspired by the HTML specification.
Note that both `url` and `referrer` are canonicalized before they're used, so e.g. if you pass in `"https:example.com"`, jsdom will interpret that as if you had given `"https://example.com/"`. If you pass an unparseable URL, the call will throw. (URLs are parsed and serialized according to the [URL Standard](http://url.spec.whatwg.org/).)
@@ -91,7 +91,7 @@ If you want to execute _external_ scripts, included via `<script src="">`, you'l
Note that event handler attributes, like `<div onclick="">`, will also not function unless `runScripts` is set to `"dangerously"`. (However, event handler _properties_, like `div.onclick = ...`, will function regardless of `runScripts`.)
If you are simply trying to execute script "from the outside", instead of letting `<script>` elements (and inline event handlers) run "from the inside", you can use the `runScripts: "outside-only"` option, which enables `window.eval`:
If you are simply trying to execute script "from the outside", instead of letting `<script>` elements (and inline event handlers) run "from the inside", you can use the `runScripts: "outside-only"` option, which enables all the JavaScript spec-provided globals to be installed on `window`. This includes things like `window.Array`, `window.Promise`, etc. It also, notably, includes `window.eval`, which allows running scripts, but with the jsdom `window` as the global:
```js
const window = (new JSDOM(``, { runScripts: "outside-only" })).window;
@@ -128,14 +128,66 @@ Note that jsdom still [does not do any layout or rendering](#unimplemented-parts
### Loading subresources
#### Basic options
By default, jsdom will not load any subresources such as scripts, stylesheets, images, or iframes. If you'd like jsdom to load such resources, you can pass the `resources: "usable"` option, which will load all usable resources. Those are:
* Frames and iframes, via `<frame>` and `<iframe>`
* Stylesheets, via `<link rel="stylesheet">`
* Scripts, via `<script>`, but only if `runScripts: "dangerously"` is also set
* Images, via `<img>`, but only if the `canvas` (or `canvas-prebuilt`) npm package is also installed (see "Canvas Support" below)
* Images, via `<img>`, but only if the `canvas` npm package is also installed (see "[Canvas Support](#canvas-support)" below)
In the future we plan to offer more customization of resource loading via this option, but for now the default and the `"usable"` option are the two modes offered.
#### Advanced configuration
_This resource loader system is new as of jsdom v12.0.0, and we'd love your feedback on whether it meets your needs and how easy it is to use. Please file an issue to discuss!_
To more fully customize jsdom's resource-loading behavior, you can pass an instance of the `ResourceLoader` class as the `resources` option value:
```js
const resourceLoader = new jsdom.ResourceLoader({
proxy: "http://127.0.0.1:9001",
strictSSL: false,
userAgent: "Mellblomenator/9000",
});
const dom = new JSDOM(``, { resources: resourceLoader });
```
The three options to the `ResourceLoader` constructor are:
- `proxy` is the address of an HTTP proxy to be used.
- `strictSSL` can be set to false to disable the requirement that SSL certificates be valid.
- `userAgent` affects the `User-Agent` header sent, and thus the resulting value for `navigator.userAgent`. It defaults to <code>\`Mozilla/5.0 (${process.platform || "unknown OS"}) AppleWebKit/537.36 (KHTML, like Gecko) jsdom/${jsdomVersion}\`</code>.
You can further customize resource fetching by subclassing `ResourceLoader` and overriding the `fetch()` method. For example, here is a version that only returns results for requests to a trusted origin:
```js
class CustomResourceLoader extends jsdom.ResourceLoader {
fetch(url, options) {
// Override the contents of this script to do something unusual.
if (url === "https://example.com/some-specific-script.js") {
return Promise.resolve(Buffer.from("window.someGlobal = 5;"));
}
return super.fetch(url, options);
}
}
```
jsdom will call your custom resource loader's `fetch()` method whenever it encounters a "usable" resource, per the above section. The method takes a URL string, as well as a few options which you should pass through unmodified if calling `super.fetch()`. It must return a promise for a Node.js `Buffer` object, or return `null` if the resource is intentionally not to be loaded. In general, most cases will want to delegate to `super.fetch()`, as shown.
One of the options you will receive in `fetch()` will be the element (if applicable) that is fetching a resource.
```js
class CustomResourceLoader extends jsdom.ResourceLoader {
fetch(url, options) {
if (options.element) {
console.log(`Element ${options.element.localName} is requesting the url ${url}`);
}
return super.fetch(url, options);
}
}
```
### Virtual consoles
@@ -172,7 +224,7 @@ There is also a special event, `"jsdomError"`, which will fire with error object
- Script execution errors that are not handled by a window `onerror` event handler that returns `true` or calls `event.preventDefault()`
- Not-implemented errors resulting from calls to methods, like `window.alert`, which jsdom does not implement, but installs anyway for web compatibility
If you're using `sendTo(c)` to send errors to `c`, by default it will call `console.error` with information from `"jsdomError"` events. If you'd prefer to maintain a strict one-to-one mapping of events to method calls, and perhaps handle `"jsdomError"`s yourself, then you can do
If you're using `sendTo(c)` to send errors to `c`, by default it will call `c.error(errorStack[, errorDetail])` with information from `"jsdomError"` events. If you'd prefer to maintain a strict one-to-one mapping of events to method calls, and perhaps handle `"jsdomError"`s yourself, then you can do
```js
virtualConsole.sendTo(c, { omitJSDOMErrors: true });
@@ -257,7 +309,7 @@ console.log(dom.nodeLocation(imgEl)); // { startOffset: 13, endOffset: 32 }
Note that this feature only works if you have set the `includeNodeLocations` option; node locations are off by default for performance reasons.
### Running vm-created scripts with `runVMScript(script)`
### Running vm-created scripts with `runVMScript(script[, options])`
The built-in `vm` module of Node.js allows you to create `Script` instances, which can be compiled ahead of time and then run multiple times on a given "VM context". Behind the scenes, a jsdom `Window` is indeed a VM context. To get access to this ability, use the `runVMScript()` method:
@@ -282,6 +334,8 @@ dom.window.ran === 3;
This is somewhat-advanced functionality, and we advise sticking to normal DOM APIs (such as `window.eval()` or `document.createElement("script")`) unless you have very specific needs.
`runVMScript()` also takes an `options` object as its second argument. See the [Node.js docs](https://nodejs.org/api/vm.html#vm_script_runincontext_contextifiedsandbox_options) for details. (This functionality does not work when [using jsdom in a web browser](running-jsdom-inside-a-web-browser).)
### Reconfiguring the jsdom with `reconfigure(settings)`
The `top` property on `window` is marked `[Unforgeable]` in the spec, meaning it is a non-configurable own property and thus cannot be overridden or shadowed by normal code running inside the jsdom, even using `Object.defineProperty`.
@@ -302,7 +356,7 @@ dom.window.top === myFakeTopForTesting;
dom.window.location.href === "https://example.com/";
```
Note that changing the jsdom's URL will impact all APIs that return the current document URL, such as `window.location`, `document.URL`, and `document.documentURI`, as well as resolution of relative URLs within the document, and the same-origin checks and referrer used while fetching subresources. It will not, however, perform a navigation to the contents of that URL; the contents of the DOM will remain unchanged, and no new instances of `Window`, `Document`, etc. will be created.
Note that changing the jsdom's URL will impact all APIs that return the current document URL, such as `window.location`, `document.URL`, and `document.documentURI`, as well as the resolution of relative URLs within the document, and the same-origin checks and referrer used while fetching subresources. It will not, however, perform navigation to the contents of that URL; the contents of the DOM will remain unchanged, and no new instances of `Window`, `Document`, etc. will be created.
## Convenience APIs
@@ -322,12 +376,10 @@ The options provided to `fromURL()` are similar to those provided to the `JSDOM`
- The `url` and `contentType` options cannot be provided.
- The `referrer` option is used as the HTTP `Referer` request header of the initial request.
- The `userAgent` option is used as the HTTP `User-Agent` request header of any requests.
- The `resources` option also affects the initial request; this is useful if you want to, for example, configure a proxy (see above).
- The resulting jsdom's URL, content type, and referrer are determined from the response.
- Any cookies set via HTTP `Set-Cookie` response headers are stored in the jsdom's cookie jar. Similarly, any cookies already in a supplied cookie jar are sent as HTTP `Cookie` request headers.
The initial request is not infinitely customizable to the same extent as is possible in a package like [request](https://www.npmjs.com/package/request); `fromURL()` is meant to be a convenience API for the majority of cases. If you need greater control over the initial request, you should perform it yourself, and then use the `JSDOM` constructor manually.
### `fromFile()`
Similar to `fromURL()`, jsdom also provides a `fromFile()` factory method for constructing a jsdom from a filename:
@@ -353,13 +405,13 @@ For the very simplest of cases, you might not need a whole `JSDOM` instance with
const frag = JSDOM.fragment(`<p>Hello</p><p><strong>Hi!</strong>`);
frag.childNodes.length === 2;
frag.querySelector("strong").textContent = "Why hello there!";
frag.querySelector("strong").textContent === "Hi!";
// etc.
```
Here `frag` is a [`DocumentFragment`](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment) instance, whose contents are created by parsing the provided string. The parsing is done using a `<template>` element, so you can include any element there (including ones with weird parsing rules like `<td>`).
Here `frag` is a [`DocumentFragment`](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment) instance, whose contents are created by parsing the provided string. The parsing is done using a `<template>` element, so you can include any element there (including ones with weird parsing rules like `<td>`). It's also important to note that the resulting `DocumentFragment` will not have [an associated browsing context](https://html.spec.whatwg.org/multipage/#concept-document-bc): that is, elements' `ownerDocument` will have a null `defaultView` property, resources will not load, etc.
All invocations of the `fragment()` factory result in `DocumentFragment`s that share the same owner `Document` and `Window`. This allows many calls to `fragment()` with no extra overhead. But it also means that calls to `fragment()` cannot be customized with any options.
All invocations of the `fragment()` factory result in `DocumentFragment`s that share the same template owner `Document`. This allows many calls to `fragment()` with no extra overhead. But it also means that calls to `fragment()` cannot be customized with any options.
Note that serialization is not as easy with `DocumentFragment`s as it is with full `JSDOM` objects. If you need to serialize your DOM, you should probably use the `JSDOM` constructor more directly. But for the special case of a fragment containing a single element, it's pretty easy to do through normal means:
@@ -372,7 +424,7 @@ console.log(frag.firstChild.outerHTML); // logs "<p>Hello</p>"
### Canvas support
jsdom includes support for using the [`canvas`](https://www.npmjs.com/package/canvas) or [`canvas-prebuilt`](https://npmjs.org/package/canvas-prebuilt) package to extend any `<canvas>` elements with the canvas API. To make this work, you need to include `canvas` as a dependency in your project, as a peer of `jsdom`. If jsdom can find the `canvas` package, it will use it, but if it's not present, then `<canvas>` elements will behave like `<div>`s.
jsdom includes support for using the [`canvas`](https://www.npmjs.com/package/canvas) package to extend any `<canvas>` elements with the canvas API. To make this work, you need to include `canvas` as a dependency in your project, as a peer of `jsdom`. If jsdom can find the `canvas` package, it will use it, but if it's not present, then `<canvas>` elements will behave like `<div>`s. Since jsdom v13, version 2.x of `canvas` is required; version 1.x is no longer supported.
### Encoding sniffing
@@ -408,7 +460,7 @@ By default jsdom elements are formatted as plain old JS objects in the console.
### Asynchronous script loading
People often have trouble with asynchronous script loading when using jsdom. Many pages loads scripts asynchronously, but there is no way to tell when they're done doing so, and thus when it's a good time to run your code and inspect the resulting DOM structure. This is a fundamental limitation; we cannot predict what scripts on the web page will do, and so cannot tell you when they are done loading more scripts.
People often have trouble with asynchronous script loading when using jsdom. Many pages load scripts asynchronously, but there is no way to tell when they're done doing so, and thus when it's a good time to run your code and inspect the resulting DOM structure. This is a fundamental limitation; we cannot predict what scripts on the web page will do, and so cannot tell you when they are done loading more scripts.
This can be worked around in a few ways. The best way, if you control the page in question, is to use whatever mechanisms are given by the script loader to detect when loading is done. For example, if you're using a module loader like RequireJS, the code could look like:
@@ -449,14 +501,6 @@ This is done mainly for performance and memory reasons: creating separate copies
Nevertheless, we remain interested in one day providing an option to create an "independent" jsdom, at the cost of some performance.
### Missing features in the new API
Compared to the old jsdom API from v9.x and before, the new API is noticeably missing fine-grained control of resource loads. Previous versions of jsdom allowed you to set options that were used when making requests (both for the initial request, in the old equivalent of `JSDOM.fromURL()`, and for subresource requests). They also allowed you to control which subresources were requested and applied to the main document, so that you could e.g. download stylesheets but not scripts. Finally, they provided a customizable resource loader that let you intercept any outgoing request and fulfill it with a completely synthetic response.
None of these features are yet in the new jsdom API, although we are hoping to add them back soon! This requires a decent amount of behind-the-scenes work to implement in a reasonable way, unfortunately.
In the meantime, please feel free to use the old jsdom API to get access to this functionality. It is supported and maintained, although it will not be getting new features. The documentation is found in [lib/old-api.md](./lib/old-api.md).
### Unimplemented parts of the web platform
Although we enjoy adding new features to jsdom and keeping it up to date with the latest web specs, it has many missing APIs. Please feel free to file an issue for anything missing, but we're a small and busy team, so a pull request might work even better.

152
node_modules/jsdom/lib/api.js generated vendored
View File

@@ -3,7 +3,6 @@ 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");
@@ -12,13 +11,9 @@ 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}`;
const { fragmentSerialization } = require("./jsdom/living/domparsing/serialization.js");
const ResourceLoader = require("./jsdom/browser/resources/resource-loader.js");
const NoOpResourceLoader = require("./jsdom/browser/resources/no-op-resource-loader.js");
// This symbol allows us to smuggle a non-public option through to the JSDOM constructor, for use by JSDOM.fromURL.
const transportLayerEncodingLabelHiddenOption = Symbol("transportLayerEncodingLabel");
@@ -35,31 +30,14 @@ let sharedFragmentDocument = null;
class JSDOM {
constructor(input, options = {}) {
const { html, encoding } = normalizeHTML(input, options[transportLayerEncodingLabelHiddenOption]);
options = transformOptions(options, encoding);
const mimeType = new MIMEType(options.contentType === undefined ? "text/html" : options.contentType);
const { html, encoding } = normalizeHTML(input, options[transportLayerEncodingLabelHiddenOption], mimeType);
options = transformOptions(options, encoding, mimeType);
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);
@@ -84,24 +62,24 @@ class JSDOM {
}
serialize() {
return domToHtml([idlUtils.implForWrapper(this[window]._document)]);
return fragmentSerialization(idlUtils.implForWrapper(this[window]._document), { requireWellFormed: false });
}
nodeLocation(node) {
if (!idlUtils.implForWrapper(this[window]._document)._parseOptions.locationInfo) {
if (!idlUtils.implForWrapper(this[window]._document)._parseOptions.sourceCodeLocationInfo) {
throw new Error("Location information was not saved for this jsdom. Use includeNodeLocations during creation.");
}
return idlUtils.implForWrapper(node).__location;
return idlUtils.implForWrapper(node).sourceCodeLocation;
}
runVMScript(script) {
runVMScript(script, options) {
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]);
return script.runInContext(this[window], options);
}
reconfigure(settings) {
@@ -118,11 +96,11 @@ class JSDOM {
}
document._URL = url;
document._origin = whatwgURL.serializeURLOrigin(document._URL);
document.origin = whatwgURL.serializeURLOrigin(document._URL);
}
}
static fragment(string) {
static fragment(string = "") {
if (!sharedFragmentDocument) {
sharedFragmentDocument = (new JSDOM()).window.document;
}
@@ -138,20 +116,20 @@ class JSDOM {
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)
};
const resourceLoader = resourcesToResourceLoader(options.resources);
const resourceLoaderForInitialRequest = resourceLoader.constructor === NoOpResourceLoader ?
new ResourceLoader() :
resourceLoader;
const req = resourceLoaderForInitialRequest.fetch(url, {
accept: "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
cookieJar: options.cookieJar,
referrer: options.referrer
});
return req.then(body => {
const res = req.response;
return request(url, requestOptions).then(res => {
let transportLayerEncodingLabel;
if ("content-type" in res.headers) {
const mimeType = new MIMEType(res.headers["content-type"]);
@@ -159,13 +137,13 @@ class JSDOM {
}
options = Object.assign(options, {
url: res.request.href + parsedURL.hash,
url: req.href + parsedURL.hash,
contentType: res.headers["content-type"],
referrer: res.request.getHeader("referer"),
referrer: req.getHeader("referer"),
[transportLayerEncodingLabelHiddenOption]: transportLayerEncodingLabel
});
return new JSDOM(res.body, options);
return new JSDOM(body, options);
});
});
}
@@ -193,9 +171,6 @@ function normalizeFromURLOptions(options) {
// 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;
@@ -228,7 +203,7 @@ function normalizeFromFileOptions(filename, options) {
return normalized;
}
function transformOptions(options, encoding) {
function transformOptions(options, encoding, mimeType) {
const transformed = {
windowOptions: {
// Defaults
@@ -236,33 +211,30 @@ function transformOptions(options, encoding) {
referrer: "",
contentType: "text/html",
parsingMode: "html",
userAgent: DEFAULT_USER_AGENT,
parseOptions: { locationInfo: false },
parseOptions: { sourceCodeLocationInfo: false },
runScripts: undefined,
encoding,
pretendToBeVisual: false,
storageQuota: 5000000,
// Defaults filled in later
resourceLoader: undefined,
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";
// options.contentType was parsed into mimeType by the caller.
if (!mimeType.isHTML() && !mimeType.isXML()) {
throw new RangeError(`The given content type of "${options.contentType}" was not a HTML or XML content type`);
}
transformed.windowOptions.contentType = mimeType.essence;
transformed.windowOptions.parsingMode = mimeType.isHTML() ? "html" : "xml";
if (options.url !== undefined) {
transformed.windowOptions.url = (new URL(options.url)).href;
}
@@ -271,16 +243,12 @@ function transformOptions(options, encoding) {
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.parseOptions = { sourceCodeLocationInfo: true };
}
transformed.windowOptions.cookieJar = options.cookieJar === undefined ?
@@ -291,13 +259,12 @@ function transformOptions(options, encoding) {
(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 (!(transformed.windowOptions.virtualConsole instanceof VirtualConsole)) {
throw new TypeError("virtualConsole must be an instance of VirtualConsole");
}
transformed.windowOptions.resourceLoader = resourcesToResourceLoader(options.resources);
if (options.runScripts !== undefined) {
transformed.windowOptions.runScripts = String(options.runScripts);
if (transformed.windowOptions.runScripts !== "dangerously" &&
@@ -314,12 +281,16 @@ function transformOptions(options, encoding) {
transformed.windowOptions.pretendToBeVisual = Boolean(options.pretendToBeVisual);
}
if (options.storageQuota !== undefined) {
transformed.windowOptions.storageQuota = Number(options.storageQuota);
}
// concurrentNodeIterators??
return transformed;
}
function normalizeHTML(html = "", transportLayerEncodingLabel) {
function normalizeHTML(html = "", transportLayerEncodingLabel, mimeType) {
let encoding = "UTF-8";
if (ArrayBuffer.isView(html)) {
@@ -329,7 +300,10 @@ function normalizeHTML(html = "", transportLayerEncodingLabel) {
}
if (Buffer.isBuffer(html)) {
encoding = sniffHTMLEncoding(html, { defaultEncoding: "windows-1252", transportLayerEncodingLabel });
encoding = sniffHTMLEncoding(html, {
defaultEncoding: mimeType.isXML() ? "UTF-8" : "windows-1252",
transportLayerEncodingLabel
});
html = whatwgEncoding.decode(html, encoding);
} else {
html = String(html);
@@ -338,9 +312,27 @@ function normalizeHTML(html = "", transportLayerEncodingLabel) {
return { html, encoding };
}
function resourcesToResourceLoader(resources) {
switch (resources) {
case undefined: {
return new NoOpResourceLoader();
}
case "usable": {
return new ResourceLoader();
}
default: {
if (!(resources instanceof ResourceLoader)) {
throw new TypeError("resources must be an instance of ResourceLoader");
}
return resources;
}
}
}
exports.JSDOM = JSDOM;
exports.VirtualConsole = VirtualConsole;
exports.CookieJar = CookieJar;
exports.ResourceLoader = ResourceLoader;
exports.toughCookie = toughCookie;

View File

@@ -1,11 +1,11 @@
"use strict";
const vm = require("vm");
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 Element = require("../living/generated/Element");
const EventTarget = require("../living/generated/EventTarget");
const namedPropertiesWindow = require("../living/named-properties-window");
const cssom = require("cssom");
@@ -23,25 +23,25 @@ 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 { fireAnEvent } = require("../living/helpers/events");
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;
const defaultStyleSheet = require("./default-stylesheet");
let parsedDefaultStyleSheet;
// 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.
@@ -75,6 +75,8 @@ function Window(options) {
///// PRIVATE DATA PROPERTIES
this._resourceLoader = options.resourceLoader;
// vm initialization is deferred until script processing is activated
this._globalProxy = this;
Object.defineProperty(idlUtils.implForWrapper(this), idlUtils.wrapperSymbol, { get: () => this._globalProxy });
@@ -92,16 +94,7 @@ function Window(options) {
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
@@ -114,16 +107,7 @@ function Window(options) {
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._virtualConsole = options.virtualConsole;
this._runScripts = options.runScripts;
if (this._runScripts === "outside-only" || this._runScripts === "dangerously") {
@@ -141,6 +125,41 @@ function Window(options) {
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
@@ -151,7 +170,7 @@ function Window(options) {
const statusbar = BarProp.create();
const toolbar = BarProp.create();
const external = External.create();
const navigator = Navigator.create([], { userAgent: options.userAgent });
const navigator = Navigator.create([], { userAgent: this._resourceLoader._userAgent });
const performance = Performance.create([], { rawPerformance });
const screen = Screen.create();
@@ -163,7 +182,7 @@ function Window(options) {
return window._globalProxy;
},
get frameElement() {
return window._frameElement;
return idlUtils.wrapperForImpl(window._frameElement);
},
get frames() {
return window._globalProxy;
@@ -215,6 +234,20 @@ function Window(options) {
},
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;
}
});
@@ -370,12 +403,6 @@ function Window(options) {
writable: true
});
function wrapConsoleMethod(method) {
return (...args) => {
window._virtualConsole.emit(method, ...args);
};
}
this.postMessage = postMessage;
this.atob = function (str) {
@@ -469,24 +496,31 @@ function Window(options) {
WebSocketImpl.cleanUpWindow(this);
};
this.getComputedStyle = function (node) {
const nodeImpl = idlUtils.implForWrapper(node);
const s = node.style;
const cs = new CSSStyleDeclaration();
const { forEach } = Array.prototype;
this.getComputedStyle = function (elt) {
elt = Element.convert(elt);
const declaration = new CSSStyleDeclaration();
const { forEach, indexOf } = Array.prototype;
const { style } = elt;
function setPropertiesFromRule(rule) {
if (!rule.selectorText) {
return;
}
const selectors = rule.selectorText.split(cssSelectorSplitRE);
const cssSelectorSplitRe = /((?:[^,"']|"[^"]*"|'[^']*')+)/;
const selectors = rule.selectorText.split(cssSelectorSplitRe);
let matched = false;
for (const selectorText of selectors) {
if (selectorText !== "" && selectorText !== "," && !matched && matchesDontThrow(nodeImpl, selectorText)) {
if (selectorText !== "" && selectorText !== "," && !matched && matchesDontThrow(elt, selectorText)) {
matched = true;
forEach.call(rule.style, property => {
cs.setProperty(property, rule.style.getPropertyValue(property), rule.style.getPropertyPriority(property));
declaration.setProperty(
property,
rule.style.getPropertyValue(property),
rule.style.getPropertyPriority(property)
);
});
}
}
@@ -495,7 +529,7 @@ function Window(options) {
function readStylesFromStyleSheet(sheet) {
forEach.call(sheet.cssRules, rule => {
if (rule.media) {
if (Array.prototype.indexOf.call(rule.media, "screen") !== -1) {
if (indexOf.call(rule.media, "screen") !== -1) {
forEach.call(rule.cssRules, setPropertiesFromRule);
}
} else {
@@ -504,14 +538,17 @@ function Window(options) {
});
}
readStylesFromStyleSheet(defaultStyleSheet);
forEach.call(node.ownerDocument.styleSheets, readStylesFromStyleSheet);
if (!parsedDefaultStyleSheet) {
parsedDefaultStyleSheet = cssom.parse(defaultStyleSheet);
}
readStylesFromStyleSheet(parsedDefaultStyleSheet);
forEach.call(elt.ownerDocument.styleSheets, readStylesFromStyleSheet);
forEach.call(s, property => {
cs.setProperty(property, s.getPropertyValue(property), s.getPropertyPriority(property));
forEach.call(style, property => {
declaration.setProperty(property, style.getPropertyValue(property), style.getPropertyPriority(property));
});
return cs;
return declaration;
};
// The captureEvents() and releaseEvents() methods must do nothing
@@ -521,11 +558,20 @@ function Window(options) {
///// PUBLIC DATA PROPERTIES (TODO: should be getters)
function wrapConsoleMethod(method) {
return (...args) => {
window._virtualConsole.emit(method, ...args);
};
}
this.console = {
assert: wrapConsoleMethod("assert"),
clear: wrapConsoleMethod("clear"),
count: wrapConsoleMethod("count"),
countReset: wrapConsoleMethod("countReset"),
debug: wrapConsoleMethod("debug"),
dir: wrapConsoleMethod("dir"),
dirxml: wrapConsoleMethod("dirxml"),
error: wrapConsoleMethod("error"),
group: wrapConsoleMethod("group"),
groupCollapsed: wrapConsoleMethod("groupCollapsed"),
@@ -546,10 +592,8 @@ function Window(options) {
}
define(this, {
name: "nodejs",
// Node v6 has issues (presumably in the vm module)
// which this property exposes through an XHR test
// status: "",
name: "",
status: "",
devicePixelRatio: 1,
innerWidth: 1024,
innerHeight: 768,
@@ -558,15 +602,12 @@ function Window(options) {
pageXOffset: 0,
pageYOffset: 0,
screenX: 0,
screenLeft: 0,
screenY: 0,
screenTop: 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"),
@@ -591,14 +632,10 @@ function Window(options) {
}
if (window.document.readyState === "complete") {
const ev = window.document.createEvent("HTMLEvents");
ev.initEvent("load", false, false);
window.dispatchEvent(ev);
fireAnEvent("load", window);
} else {
window.document.addEventListener("load", () => {
const ev = window.document.createEvent("HTMLEvents");
ev.initEvent("load", false, false);
window.dispatchEvent(ev);
fireAnEvent("load", window);
});
}
});
@@ -652,3 +689,13 @@ function stopAllTimers(timers) {
timer[1].call(undefined, timer[0]);
});
}
function contextifyWindow(window) {
if (vm.isContext(window)) {
return;
}
vm.createContext(window);
const documentImpl = idlUtils.implForWrapper(window._document);
documentImpl._defaultView = window._globalProxy = vm.runInContext("this", window);
}

View File

@@ -1,55 +0,0 @@
"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);
};

View File

@@ -1,18 +0,0 @@
"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;
};

View File

@@ -1,34 +1,15 @@
"use strict";
const parse5 = require("parse5");
const sax = require("sax");
const saxes = require("saxes");
const attributes = require("../living/attributes");
const DocumentType = require("../living/generated/DocumentType");
const JSDOMParse5Adapter = require("./parse5-adapter-parsing");
// 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();
}
};
const { HTML_NS } = require("../living/helpers/namespaces");
module.exports = class HTMLToDOM {
constructor(parsingMode) {
this.parser = parsingMode === "xml" ? sax : parse5;
this.parser = parsingMode === "xml" ? saxes : parse5;
}
appendToNode(html, node) {
@@ -44,7 +25,7 @@ module.exports = class HTMLToDOM {
}
_doParse(...args) {
return this.parser === parse5 ? this._parseWithParse5(...args) : this._parseWithSax(...args);
return this.parser === parse5 ? this._parseWithParse5(...args) : this._parseWithSaxes(...args);
}
_parseWithParse5(html, isFragment, contextNode, options = {}) {
@@ -66,90 +47,93 @@ module.exports = class HTMLToDOM {
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];
_parseWithSaxes(html, isFragment, contextNode) {
const parserOptions = { xmlns: true };
if (isFragment) {
parserOptions.fragment = true;
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
parserOptions.resolvePrefix = prefix => {
// saxes wants undefined as the return value if the prefix is not
// defined, not null.
return contextNode.lookupNamespaceURI(prefix) || undefined;
};
}
const parser = new this.parser.SaxesParser(parserOptions);
const openStack = [contextNode];
const currentDocument = contextNode._ownerDocument || contextNode;
if (arg.local === "script" && arg.uri === "http://www.w3.org/1999/xhtml") {
openStack.push(tag);
} else {
const elem = setChildForSax(openStack[openStack.length - 1], tag);
openStack.push(elem);
parser.ontext = isFragment ?
// In a fragment, all text events produced by saxes must result in a text
// node.
text => {
appendChild(
openStack[openStack.length - 1],
currentDocument.createTextNode(text)
);
} :
// When parsing a whole document, we must ignore those text nodes that are
// produced outside the root element. Saxes produces events for them,
// but DOM trees do not record text outside the root element.
text => {
if (openStack.length > 1) {
appendChild(
openStack[openStack.length - 1],
currentDocument.createTextNode(text)
);
}
};
parser.oncdata = cdata => {
appendChild(
openStack[openStack.length - 1],
currentDocument.createCDATASection(cdata)
);
};
parser.onopentag = tag => {
const { local: tagLocal, uri: tagURI, prefix: tagPrefix, attributes: tagAttributes } = tag;
const elem = currentDocument._createElementWithCorrectElementInterface(tagLocal, tagURI);
elem._prefix = tagPrefix || null;
elem._namespaceURI = tagURI || null;
// We mark a script element as "parser-inserted", which prevents it from
// being immediately executed.
if (tagLocal === "script" && tagURI === HTML_NS) {
elem._parserInserted = true;
}
for (const key of Object.keys(tagAttributes)) {
const { prefix, local, uri, value } = tagAttributes[key];
attributes.setAttributeValue(
elem, local, value, prefix === "" ? null : prefix,
uri === "" ? null : uri
);
}
appendChild(openStack[openStack.length - 1], elem);
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);
// Once a script is populated, we can execute it.
if (elem.localName === "script" && elem.namespaceURI === HTML_NS) {
elem._eval();
}
};
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
});
appendChild(
openStack[openStack.length - 1],
currentDocument.createComment(comment)
);
};
parser.onprocessinginstruction = pi => {
setChildForSax(openStack[openStack.length - 1], {
type: "directive",
name: "?" + pi.name,
data: "?" + pi.name + " " + pi.body + "?"
});
parser.onprocessinginstruction = ({ target, body }) => {
appendChild(
openStack[openStack.length - 1],
currentDocument.createProcessingInstruction(target, body)
);
};
parser.ondoctype = dt => {
setChildForSax(openStack[openStack.length - 1], {
type: "directive",
name: "!doctype",
data: "!doctype " + dt
});
appendChild(
openStack[openStack.length - 1],
parseDocType(currentDocument, `<!doctype ${dt}>`)
);
const entityMatcher = /<!ENTITY ([^ ]+) "([^"]+)">/g;
let result;
@@ -168,82 +152,20 @@ module.exports = class HTMLToDOM {
}
};
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 === "http://www.w3.org/1999/xhtml") {
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;
function appendChild(parent, child) {
if (parent._templateContents) {
// Template elements do not have children but instead store their content
// in a separate hierarchy.
parent._templateContents._insert(child, null);
} else {
parent._insert(child, null);
}
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;
const CUSTOM_NAME_DOCTYPE = /<!doctype\s+([^\s>]+)/i;
function parseDocType(doc, html) {
if (HTML5_DOCTYPE.test(html)) {
@@ -260,9 +182,8 @@ function parseDocType(doc, html) {
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", "", "");
const namePiece = CUSTOM_NAME_DOCTYPE.exec(html)[1] || "html";
return createDocumentTypeInternal(doc, namePiece, "", "");
}
function createDocumentTypeInternal(ownerDocument, name, publicId, systemId) {

View File

@@ -1,15 +1,53 @@
"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");
const serializationAdapter = require("../living/domparsing/parse5-adapter-serialization");
const OpenElementStack = require("parse5/lib/parser/open-element-stack");
const OpenElementStackOriginalPop = OpenElementStack.prototype.pop;
const OpenElementStackOriginalPush = OpenElementStack.prototype.push;
module.exports = class JSDOMParse5Adapter {
constructor(documentImpl) {
this._documentImpl = documentImpl;
// Since the createElement hook doesn't provide the parent element, we keep track of this using _currentElement:
// https://github.com/inikulin/parse5/issues/285
this._currentElement = undefined;
// Horrible monkey-patch to implement https://github.com/inikulin/parse5/issues/237
const adapter = this;
OpenElementStack.prototype.push = function (...args) {
OpenElementStackOriginalPush.apply(this, args);
adapter._currentElement = this.current;
const after = this.items[this.stackTop];
if (after._pushedOnStackOfOpenElements) {
after._pushedOnStackOfOpenElements();
}
};
OpenElementStack.prototype.pop = function (...args) {
const before = this.items[this.stackTop];
OpenElementStackOriginalPop.apply(this, args);
adapter._currentElement = this.current;
if (before._poppedOffStackOfOpenElements) {
before._poppedOffStackOfOpenElements();
}
};
}
_ownerDocument() {
// The _currentElement is undefined when parsing elements at the root of the document. In this case we would
// fallback to the global _documentImpl.
return this._currentElement ? this._currentElement._ownerDocument : this._documentImpl;
}
createDocument() {
@@ -21,11 +59,13 @@ module.exports = class JSDOMParse5Adapter {
}
createDocumentFragment() {
return DocumentFragment.createImpl([], { ownerDocument: this._documentImpl });
return DocumentFragment.createImpl([], { ownerDocument: this._currentElement._ownerDocument });
}
createElement(localName, namespace, attrs) {
const element = this._documentImpl._createElementWithCorrectElementInterface(localName, namespace);
const ownerDocument = this._ownerDocument();
const element = ownerDocument._createElementWithCorrectElementInterface(localName, namespace);
element._namespaceURI = namespace;
this.adoptAttributes(element, attrs);
@@ -37,7 +77,8 @@ module.exports = class JSDOMParse5Adapter {
}
createCommentNode(data) {
return Comment.createImpl([], { data, ownerDocument: this._documentImpl });
const ownerDocument = this._ownerDocument();
return Comment.createImpl([], { data, ownerDocument });
}
appendChild(parentNode, newNode) {
@@ -49,22 +90,25 @@ module.exports = class JSDOMParse5Adapter {
}
setTemplateContent(templateElement, contentFragment) {
// This code makes the glue between jsdom and parse5 HTMLTemplateElement parsing:
//
// * jsdom during the construction of the HTMLTemplateElement (for example when create via
// `document.createElement("template")`), creates a DocumentFragment and set it into _templateContents.
// * parse5 when parsing a <template> tag creates an HTMLTemplateElement (`createElement` adapter hook) and also
// create a DocumentFragment (`createDocumentFragment` adapter hook).
//
// At this point we now have to replace the one created in jsdom with one created by parse5.
const { _ownerDocument, _host } = templateElement._templateContents;
contentFragment._ownerDocument = _ownerDocument;
contentFragment._host = _host;
templateElement._templateContents = contentFragment;
}
setDocumentType(document, name, publicId, systemId) {
// parse5 sometimes gives us these as null.
if (name === null) {
name = "";
}
if (publicId === null) {
publicId = "";
}
if (systemId === null) {
systemId = "";
}
const ownerDocument = this._ownerDocument();
const documentType = DocumentType.createImpl([], { name, publicId, systemId, ownerDocument });
const documentType = DocumentType.createImpl([], { name, publicId, systemId, ownerDocument: this._documentImpl });
document.appendChild(documentType);
}
@@ -82,8 +126,8 @@ module.exports = class JSDOMParse5Adapter {
if (lastChild && lastChild.nodeType === nodeTypes.TEXT_NODE) {
lastChild.data += text;
} else {
const textNode = Text.createImpl([], { data: text, ownerDocument: this._documentImpl });
const ownerDocument = this._ownerDocument();
const textNode = Text.createImpl([], { data: text, ownerDocument });
parentNode.appendChild(textNode);
}
}
@@ -93,8 +137,8 @@ module.exports = class JSDOMParse5Adapter {
if (previousSibling && previousSibling.nodeType === nodeTypes.TEXT_NODE) {
previousSibling.data += text;
} else {
const textNode = Text.createImpl([], { data: text, ownerDocument: this._documentImpl });
const ownerDocument = this._ownerDocument();
const textNode = Text.createImpl([], { data: text, ownerDocument });
parentNode.insertBefore(textNode, referenceNode);
}
}

View File

@@ -1,275 +0,0 @@
"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);
}
};

View File

@@ -0,0 +1,114 @@
"use strict";
class QueueItem {
constructor(onLoad, onError, dependentItem) {
this.onLoad = onLoad;
this.onError = onError;
this.data = null;
this.error = null;
this.dependentItem = dependentItem;
}
}
/**
* AsyncResourceQueue is the queue in charge of run the async scripts
* and notify when they finish.
*/
module.exports = class AsyncResourceQueue {
constructor() {
this.items = new Set();
this.dependentItems = new Set();
}
count() {
return this.items.size + this.dependentItems.size;
}
_notify() {
if (this._listener) {
this._listener();
}
}
_check(item) {
let promise;
if (item.onError && item.error) {
promise = item.onError(item.error);
} else if (item.onLoad && item.data) {
promise = item.onLoad(item.data);
}
promise
.then(() => {
this.items.delete(item);
this.dependentItems.delete(item);
if (this.count() === 0) {
this._notify();
}
});
}
setListener(listener) {
this._listener = listener;
}
push(request, onLoad, onError, dependentItem) {
const q = this;
const item = new QueueItem(onLoad, onError, dependentItem);
q.items.add(item);
return request
.then(data => {
item.data = data;
if (dependentItem && !dependentItem.finished) {
q.dependentItems.add(item);
return q.items.delete(item);
}
if (onLoad) {
return q._check(item);
}
q.items.delete(item);
if (q.count() === 0) {
q._notify();
}
return null;
})
.catch(err => {
item.error = err;
if (dependentItem && !dependentItem.finished) {
q.dependentItems.add(item);
return q.items.delete(item);
}
if (onError) {
return q._check(item);
}
q.items.delete(item);
if (q.count() === 0) {
q._notify();
}
return null;
});
}
notifyItem(syncItem) {
for (const item of this.dependentItems) {
if (item.dependentItem === syncItem) {
this._check(item);
}
}
}
};

View File

@@ -0,0 +1,8 @@
"use strict";
const ResourceLoader = require("./resource-loader.js");
module.exports = class NoOpResourceLoader extends ResourceLoader {
fetch() {
return null;
}
};

View File

@@ -0,0 +1,95 @@
"use strict";
const idlUtils = require("../../living/generated/utils");
const { fireAnEvent } = require("../../living/helpers/events");
module.exports = class PerDocumentResourceLoader {
constructor(document) {
this._document = document;
this._defaultEncoding = document._encoding;
this._resourceLoader = document._defaultView ? document._defaultView._resourceLoader : null;
this._requestManager = document._requestManager;
this._queue = document._queue;
this._deferQueue = document._deferQueue;
this._asyncQueue = document._asyncQueue;
}
fetch(url, { element, onLoad, onError }) {
const request = this._resourceLoader.fetch(url, {
cookieJar: this._document._cookieJar,
element: idlUtils.wrapperForImpl(element),
referrer: this._document.URL
});
if (request === null) {
return null;
}
this._requestManager.add(request);
const onErrorWrapped = error => {
this._requestManager.remove(request);
if (onError) {
onError(error);
}
fireAnEvent("error", element);
const err = new Error(`Could not load ${element.localName}: "${url}"`);
err.type = "resource loading";
err.detail = error;
this._document._defaultView._virtualConsole.emit("jsdomError", err);
return Promise.resolve();
};
const onLoadWrapped = data => {
this._requestManager.remove(request);
this._addCookies(url, request.response ? request.response.headers : {});
try {
const result = onLoad ? onLoad(data) : undefined;
return Promise.resolve(result)
.then(() => {
fireAnEvent("load", element);
return Promise.resolve();
})
.catch(err => {
return onErrorWrapped(err);
});
} catch (err) {
return onErrorWrapped(err);
}
};
if (element.localName === "script" && element.hasAttribute("async")) {
this._asyncQueue.push(request, onLoadWrapped, onErrorWrapped, this._queue.getLastScript());
} else if (element.localName === "script" && element.hasAttribute("defer")) {
this._deferQueue.push(request, onLoadWrapped, onErrorWrapped, false, element);
} else {
this._queue.push(request, onLoadWrapped, onErrorWrapped, false, element);
}
return request;
}
_addCookies(url, headers) {
let cookies = headers["set-cookie"];
if (!cookies) {
return;
}
if (!Array.isArray(cookies)) {
cookies = [cookies];
}
cookies.forEach(cookie => {
this._document._cookieJar.setCookieSync(cookie, url, { http: true, ignoreError: true });
});
}
};

View File

@@ -0,0 +1,33 @@
"use strict";
/**
* Manage all the request and it is able to abort
* all pending request.
*/
module.exports = class RequestManager {
constructor() {
this.openedRequests = [];
}
add(req) {
this.openedRequests.push(req);
}
remove(req) {
const idx = this.openedRequests.indexOf(req);
if (idx !== -1) {
this.openedRequests.splice(idx, 1);
}
}
close() {
for (const openedRequest of this.openedRequests) {
openedRequest.abort();
}
this.openedRequests = [];
}
size() {
return this.openedRequests.length;
}
};

View File

@@ -0,0 +1,113 @@
"use strict";
const fs = require("fs");
const { parseURL } = require("whatwg-url");
const dataURLFromRecord = require("data-urls").fromURLRecord;
const request = require("request-promise-native");
const wrapCookieJarForRequest = require("../../living/helpers/wrap-cookie-jar-for-request");
const packageVersion = require("../../../../package.json").version;
const IS_BROWSER = Object.prototype.toString.call(process) !== "[object process]";
module.exports = class ResourceLoader {
constructor({
strictSSL = true,
proxy = undefined,
userAgent = `Mozilla/5.0 (${process.platform || "unknown OS"}) AppleWebKit/537.36 ` +
`(KHTML, like Gecko) jsdom/${packageVersion}`
} = {}) {
this._strictSSL = strictSSL;
this._proxy = proxy;
this._userAgent = userAgent;
}
_readFile(filePath) {
let readableStream;
let abort; // Native Promises doesn't have an "abort" method.
/*
* Creating a promise for two reason:
* 1. fetch always return a promise.
* 2. We need to add an abort handler.
*/
const promise = new Promise((resolve, reject) => {
readableStream = fs.createReadStream(filePath);
let data = Buffer.alloc(0);
abort = reject;
readableStream.on("error", reject);
readableStream.on("data", chunk => {
data = Buffer.concat([data, chunk]);
});
readableStream.on("end", () => {
resolve(data);
});
});
promise.abort = () => {
readableStream.destroy();
const error = new Error("request canceled by user");
error.isAbortError = true;
abort(error);
};
return promise;
}
_getRequestOptions({ cookieJar, referrer, accept = "*/*" }) {
const requestOptions = {
encoding: null,
gzip: true,
jar: wrapCookieJarForRequest(cookieJar),
strictSSL: this._strictSSL,
proxy: this._proxy,
forever: true,
headers: {
"User-Agent": this._userAgent,
"Accept-Language": "en",
Accept: accept
}
};
if (referrer && !IS_BROWSER) {
requestOptions.headers.referer = referrer;
}
return requestOptions;
}
fetch(urlString, options = {}) {
const url = parseURL(urlString);
if (!url) {
return Promise.reject(new Error(`Tried to fetch invalid URL ${urlString}`));
}
switch (url.scheme) {
case "data": {
return Promise.resolve(dataURLFromRecord(url).body);
}
case "http":
case "https": {
const requestOptions = this._getRequestOptions(options);
return request(urlString, requestOptions);
}
case "file": {
// TODO: Improve the URL => file algorithm. See https://github.com/jsdom/jsdom/pull/2279#discussion_r199977987
const filePath = urlString
.replace(/^file:\/\//, "")
.replace(/^\/([a-z]):\//i, "$1:/")
.replace(/%20/g, " ");
return this._readFile(filePath);
}
default: {
return Promise.reject(new Error(`Tried to fetch URL ${urlString} with invalid scheme ${url.scheme}`));
}
}
}
};

View File

@@ -0,0 +1,142 @@
"use strict";
/**
* Queue for all the resources to be download except async scripts.
* Async scripts have their own queue AsyncResourceQueue.
*/
module.exports = class ResourceQueue {
constructor({ paused, asyncQueue } = {}) {
this.paused = Boolean(paused);
this._asyncQueue = asyncQueue;
}
getLastScript() {
let head = this.tail;
while (head) {
if (head.isScript) {
return head;
}
head = head.prev;
}
return null;
}
_moreScripts() {
let found = false;
let head = this.tail;
while (head && !found) {
found = head.isScript;
head = head.prev;
}
return found;
}
_notify() {
if (this._listener) {
this._listener();
}
}
setListener(listener) {
this._listener = listener;
}
push(request, onLoad, onError, keepLast, element) {
const isScript = element ? element.localName === "script" : false;
if (!request) {
if (isScript && !this._moreScripts()) {
return onLoad();
}
request = new Promise(resolve => resolve());
}
const q = this;
const item = {
isScript,
err: null,
element,
fired: false,
data: null,
keepLast,
prev: q.tail,
check() {
if (!q.paused && !this.prev && this.fired) {
let promise;
if (this.err && onError) {
promise = onError(this.err);
}
if (!this.err && onLoad) {
promise = onLoad(this.data);
}
Promise.resolve(promise)
.then(() => {
if (this.next) {
this.next.prev = null;
this.next.check();
} else { // q.tail===this
q.tail = null;
q._notify();
}
this.finished = true;
if (q._asyncQueue) {
q._asyncQueue.notifyItem(this);
}
});
}
}
};
if (q.tail) {
if (q.tail.keepLast) {
// if the tail is the load event in document and we receive a new element to load
// we should add this new request before the load event.
if (q.tail.prev) {
q.tail.prev.next = item;
}
item.prev = q.tail.prev;
q.tail.prev = item;
item.next = q.tail;
} else {
q.tail.next = item;
q.tail = item;
}
} else {
q.tail = item;
}
return request
.then(data => {
item.fired = 1;
item.data = data;
item.check();
})
.catch(err => {
item.fired = true;
item.err = err;
item.check();
});
}
resume() {
if (!this.paused) {
return;
}
this.paused = false;
let head = this.tail;
while (head && head.prev) {
head = head.prev;
}
if (head) {
head.check();
}
}
};

View File

@@ -1,10 +1,9 @@
"use strict";
const { setupForSimpleEventAccessors } = require("../helpers/create-event-accessor");
const { fireAnEvent } = require("../helpers/events");
const EventTargetImpl = require("../events/EventTarget-impl").implementation;
const Event = require("../generated/Event");
class AbortSignalImpl extends EventTargetImpl {
constructor(args, privateData) {
super();
@@ -27,13 +26,7 @@ class AbortSignalImpl extends EventTargetImpl {
}
this.abortAlgorithms.clear();
this._dispatch(Event.createImpl(
[
"abort",
{ bubbles: false, cancelable: false }
],
{ isTrusted: true }
));
fireAnEvent("abort", this);
}
_addAlgorithm(algorithm) {

View File

@@ -2,6 +2,8 @@
const DOMException = require("domexception");
const attrGenerated = require("./generated/Attr");
const { asciiLowercase } = require("./helpers/strings");
const { HTML_NS } = require("./helpers/namespaces");
const { queueAttributeMutationRecord } = require("./helpers/mutation-observers");
// 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.
@@ -23,6 +25,9 @@ exports.hasAttributeByNameNS = function (element, namespace, localName) {
exports.changeAttribute = function (element, attribute, value) {
// https://dom.spec.whatwg.org/#concept-element-attributes-change
const { _localName, _namespace, _value } = attribute;
queueAttributeMutationRecord(element, _localName, _namespace, _value);
const oldValue = attribute._value;
attribute._value = value;
@@ -33,9 +38,10 @@ exports.changeAttribute = function (element, attribute, value) {
exports.appendAttribute = function (element, attribute) {
// https://dom.spec.whatwg.org/#concept-element-attributes-append
const attributeList = element._attributeList;
const { _localName, _namespace } = attribute;
queueAttributeMutationRecord(element, _localName, _namespace, null);
// TODO mutation observer stuff
const attributeList = element._attributeList;
attributeList.push(attribute);
attribute._element = element;
@@ -57,9 +63,10 @@ exports.appendAttribute = function (element, attribute) {
exports.removeAttribute = function (element, attribute) {
// https://dom.spec.whatwg.org/#concept-element-attributes-remove
const attributeList = element._attributeList;
const { _localName, _namespace, _value } = attribute;
queueAttributeMutationRecord(element, _localName, _namespace, _value);
// TODO mutation observer stuff
const attributeList = element._attributeList;
for (let i = 0; i < attributeList.length; ++i) {
if (attributeList[i] === attribute) {
@@ -86,9 +93,10 @@ exports.removeAttribute = function (element, attribute) {
exports.replaceAttribute = function (element, oldAttr, newAttr) {
// https://dom.spec.whatwg.org/#concept-element-attributes-replace
const attributeList = element._attributeList;
const { _localName, _namespace, _value } = oldAttr;
queueAttributeMutationRecord(element, _localName, _namespace, _value);
// TODO mutation observer stuff
const attributeList = element._attributeList;
for (let i = 0; i < attributeList.length; ++i) {
if (attributeList[i] === oldAttr) {
@@ -117,7 +125,7 @@ exports.replaceAttribute = function (element, oldAttr, newAttr) {
exports.getAttributeByName = function (element, name) {
// https://dom.spec.whatwg.org/#concept-element-attributes-get-by-name
if (element._namespaceURI === "http://www.w3.org/1999/xhtml" &&
if (element._namespaceURI === HTML_NS &&
element._ownerDocument._parsingMode === "html") {
name = asciiLowercase(name);
}

View File

@@ -3,6 +3,7 @@
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) {
@@ -28,7 +29,7 @@ exports.implementation = class NamedNodeMapImpl {
get [idlUtils.supportedPropertyNames]() {
const names = new Set(this._attributeList.map(a => a._qualifiedName));
const el = this._element;
if (el._namespaceURI === "http://www.w3.org/1999/xhtml" && el._ownerDocument._parsingMode === "html") {
if (el._namespaceURI === HTML_NS && el._ownerDocument._parsingMode === "html") {
for (const name of names) {
const lowercaseName = name.toLowerCase();
if (lowercaseName !== name) {

View File

@@ -1,9 +1,9 @@
"use strict";
const ValidityState = require("../generated/ValidityState");
const Event = require("../generated/Event");
const { isDisabled } = require("../helpers/form-controls");
const { closest } = require("../helpers/traversal");
const { fireAnEvent } = require("../helpers/events");
exports.implementation = class DefaultConstraintValidationImpl {
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-cva-willvalidate
@@ -26,7 +26,7 @@ exports.implementation = class DefaultConstraintValidationImpl {
if (this._satisfiesConstraints()) {
return true;
}
this.dispatchEvent(Event.createImpl(["invalid", { cancelable: true }]));
fireAnEvent("invalid", this, undefined, { cancelable: true });
return false;
}

View File

@@ -1,6 +1,5 @@
"use strict";
const Document = require("../generated/Document");
const { applyDocumentFeatures } = require("../../browser/documentfeatures");
exports.implementation = class DOMParserImpl {
parseFromString(string, contentType) {
@@ -38,17 +37,13 @@ function createScriptingDisabledDocument(parsingMode, contentType, string) {
options: {
parsingMode,
encoding: "UTF-8",
contentType
contentType,
readyState: "complete",
scriptingDisabled: true
// 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);
}

View File

@@ -1,7 +1,7 @@
"use strict";
const idlUtils = require("../living/generated/utils");
const nodeTypes = require("../living/node-type");
const { domSymbolTree } = require("../living/helpers/internal-constants");
const idlUtils = require("../generated/utils");
const nodeTypes = require("../node-type");
const { domSymbolTree } = require("../helpers/internal-constants");
// Serialization only requires a subset of the tree adapter interface.
// Tree traversing
@@ -31,7 +31,6 @@ exports.getTemplateContent = templateElement => templateElement._templateContent
exports.getDocumentMode = document => document._mode;
// Node types
exports.isTextNode = node => node.nodeType === nodeTypes.TEXT_NODE;
exports.isCommentNode = node => node.nodeType === nodeTypes.COMMENT_NODE;
@@ -39,3 +38,10 @@ exports.isCommentNode = node => node.nodeType === nodeTypes.COMMENT_NODE;
exports.isDocumentTypeNode = node => node.nodeType === nodeTypes.DOCUMENT_TYPE_NODE;
exports.isElementNode = node => node.nodeType === nodeTypes.ELEMENT_NODE;
// Source code location
exports.setNodeSourceCodeLocation = (node, location) => {
node.sourceCodeLocation = location;
};
exports.getNodeSourceCodeLocation = node => node.sourceCodeLocation;

View File

@@ -0,0 +1,39 @@
"use strict";
const { produceXMLSerialization } = require("w3c-xmlserializer");
const parse5 = require("parse5");
const utils = require("../generated/utils");
const treeAdapter = require("./parse5-adapter-serialization");
const NODE_TYPE = require("../node-type");
const NAMESPACES = require("../helpers/namespaces");
function htmlSerialization(node) {
if (
node.nodeType === NODE_TYPE.ELEMENT_NODE &&
node.namespaceURI === NAMESPACES.HTML_NS &&
node.tagName === "TEMPLATE"
) {
node = node.content;
}
return parse5.serialize(node, { treeAdapter });
}
module.exports.fragmentSerialization = (node, { requireWellFormed }) => {
const contextDocument =
node.nodeType === NODE_TYPE.DOCUMENT_NODE ? node : node._ownerDocument;
if (contextDocument._parsingMode === "html") {
return htmlSerialization(node);
}
const childNodes = node.childNodesForSerializing || node.childNodes;
let serialized = "";
for (let i = 0; i < childNodes.length; ++i) {
serialized += produceXMLSerialization(
utils.wrapperForImpl(childNodes[i] || childNodes.item(i)),
requireWellFormed
);
}
return serialized;
};

View File

@@ -1,5 +1,6 @@
"use strict";
const idlUtils = require("../generated/utils");
const EventInit = require("../generated/EventInit");
class EventImpl {
@@ -29,12 +30,21 @@ class EventImpl {
this._stopPropagationFlag = false;
this._stopImmediatePropagationFlag = false;
this._canceledFlag = false;
this._inPassiveListenerFlag = false;
this._dispatchFlag = false;
this._path = [];
this.isTrusted = privateData.isTrusted || false;
this.timeStamp = Date.now();
}
// https://dom.spec.whatwg.org/#set-the-canceled-flag
_setTheCanceledFlag() {
if (this.cancelable && !this._inPassiveListenerFlag) {
this._canceledFlag = true;
}
}
get srcElement() {
return this.target;
}
@@ -44,8 +54,8 @@ class EventImpl {
}
set returnValue(v) {
if (this.cancelable && v === false) {
this._canceledFlag = true;
if (v === false) {
this._setTheCanceledFlag();
}
}
@@ -73,9 +83,88 @@ class EventImpl {
}
preventDefault() {
if (this.cancelable) {
this._canceledFlag = true;
this._setTheCanceledFlag();
}
// https://dom.spec.whatwg.org/#dom-event-composedpath
// Current implementation is based of https://whatpr.org/dom/699.html#dom-event-composedpath
// due to a bug in composed path implementation https://github.com/whatwg/dom/issues/684
composedPath() {
const composedPath = [];
const { currentTarget, _path: path } = this;
if (path.length === 0) {
return composedPath;
}
composedPath.push(currentTarget);
let currentTargetIndex = 0;
let currentTargetHiddenSubtreeLevel = 0;
for (let index = path.length - 1; index >= 0; index--) {
const { item, rootOfClosedTree, slotInClosedTree } = path[index];
if (rootOfClosedTree) {
currentTargetHiddenSubtreeLevel++;
}
if (item === idlUtils.implForWrapper(currentTarget)) {
currentTargetIndex = index;
break;
}
if (slotInClosedTree) {
currentTargetHiddenSubtreeLevel--;
}
}
let currentHiddenLevel = currentTargetHiddenSubtreeLevel;
let maxHiddenLevel = currentTargetHiddenSubtreeLevel;
for (let i = currentTargetIndex - 1; i >= 0; i--) {
const { item, rootOfClosedTree, slotInClosedTree } = path[i];
if (rootOfClosedTree) {
currentHiddenLevel++;
}
if (currentHiddenLevel <= maxHiddenLevel) {
composedPath.unshift(idlUtils.wrapperForImpl(item));
}
if (slotInClosedTree) {
currentHiddenLevel--;
if (currentHiddenLevel < maxHiddenLevel) {
maxHiddenLevel = currentHiddenLevel;
}
}
}
currentHiddenLevel = currentTargetHiddenSubtreeLevel;
maxHiddenLevel = currentTargetHiddenSubtreeLevel;
for (let index = currentTargetIndex + 1; index < path.length; index++) {
const { item, rootOfClosedTree, slotInClosedTree } = path[index];
if (slotInClosedTree) {
currentHiddenLevel++;
}
if (currentHiddenLevel <= maxHiddenLevel) {
composedPath.push(idlUtils.wrapperForImpl(item));
}
if (rootOfClosedTree) {
currentHiddenLevel--;
if (currentHiddenLevel < maxHiddenLevel) {
maxHiddenLevel = currentHiddenLevel;
}
}
}
return composedPath;
}
_initialize(type, bubbles, cancelable) {

View File

@@ -1,10 +1,15 @@
"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 {
isNode, isShadowRoot, isSlotable, getRoot, getEventTargetParent,
isShadowInclusiveAncestor, retarget
} = require("../helpers/shadow-dom");
const Event = require("../generated/Event").interface;
const MouseEvent = require("../generated/MouseEvent");
class EventTargetImpl {
constructor() {
@@ -19,7 +24,7 @@ class EventTargetImpl {
throw new TypeError("Only undefined, null, an object, or a function are allowed for the callback parameter");
}
options = normalizeEventHandlerOptions(options, ["capture", "once"]);
options = normalizeEventHandlerOptions(options, ["capture", "once", "passive"]);
if (callback === null) {
return;
@@ -82,63 +87,154 @@ class EventTargetImpl {
return this._dispatch(eventImpl);
}
_dispatch(eventImpl, targetOverride) {
// https://dom.spec.whatwg.org/#get-the-parent
_getTheParent() {
return null;
}
// https://dom.spec.whatwg.org/#concept-event-dispatch
// legacyOutputDidListenersThrowFlag optional parameter is not necessary here since it is only used by indexDB.
_dispatch(eventImpl, targetOverride /* , legacyOutputDidListenersThrowFlag */) {
let targetImpl = this;
let clearTargets = false;
let activationTarget = null;
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));
}
targetOverride = targetOverride || targetImpl;
let relatedTarget = retarget(eventImpl.relatedTarget, targetImpl);
eventImpl.eventPhase = Event.CAPTURING_PHASE;
for (let i = eventPath.length - 1; i >= 0; --i) {
if (eventImpl._stopPropagationFlag) {
break;
if (targetImpl !== relatedTarget || targetImpl === eventImpl.relatedTarget) {
const touchTargets = [];
appendToEventPath(eventImpl, targetImpl, targetOverride, relatedTarget, touchTargets, false);
const isActivationEvent = MouseEvent.isImpl(eventImpl) && eventImpl.type === "click";
if (isActivationEvent && targetImpl._hasActivationBehavior) {
activationTarget = targetImpl;
}
const object = eventPath[i];
const objectImpl = idlUtils.implForWrapper(object) || object; // window :(
const eventListeners = objectImpl._eventListeners[eventImpl.type];
invokeEventListeners(eventListeners, object, eventImpl);
}
let slotInClosedTree = false;
let slotable = isSlotable(targetImpl) && targetImpl._assignedSlot ? targetImpl : null;
let parent = getEventTargetParent(targetImpl, eventImpl);
eventImpl.eventPhase = Event.AT_TARGET;
// Populate event path
// https://dom.spec.whatwg.org/#event-path
while (parent !== null) {
if (slotable !== null) {
if (parent.localName !== "slot") {
throw new Error(`JSDOM Internal Error: Expected parent to be a Slot`);
}
if (!eventImpl._stopPropagationFlag) {
if (this._eventListeners[eventImpl.type]) {
const eventListeners = this._eventListeners[eventImpl.type];
invokeEventListeners(eventListeners, eventImpl.target, eventImpl);
}
}
slotable = null;
if (eventImpl.bubbles) {
eventImpl.eventPhase = Event.BUBBLING_PHASE;
for (let i = 0; i < eventPath.length; ++i) {
if (eventImpl._stopPropagationFlag) {
break;
const parentRoot = getRoot(parent);
if (isShadowRoot(parentRoot) && parentRoot.mode === "closed") {
slotInClosedTree = true;
}
}
const object = eventPath[i];
const objectImpl = idlUtils.implForWrapper(object) || object; // window :(
const eventListeners = objectImpl._eventListeners[eventImpl.type];
invokeEventListeners(eventListeners, object, eventImpl);
if (isSlotable(parent) && parent._assignedSlot) {
slotable = parent;
}
relatedTarget = retarget(eventImpl.relatedTarget, parent);
if (
(isNode(parent) && isShadowInclusiveAncestor(getRoot(targetImpl), parent)) ||
idlUtils.wrapperForImpl(parent).constructor.name === "Window"
) {
if (isActivationEvent && eventImpl.bubbles && activationTarget === null &&
parent._hasActivationBehavior) {
activationTarget = parent;
}
appendToEventPath(eventImpl, parent, null, relatedTarget, touchTargets, slotInClosedTree);
} else if (parent === relatedTarget) {
parent = null;
} else {
targetImpl = parent;
if (isActivationEvent && activationTarget === null && targetImpl._hasActivationBehavior) {
activationTarget = targetImpl;
}
appendToEventPath(eventImpl, parent, targetImpl, relatedTarget, touchTargets, slotInClosedTree);
}
if (parent !== null) {
parent = getEventTargetParent(parent, eventImpl);
}
slotInClosedTree = false;
}
let clearTargetsTupleIndex = -1;
for (let i = eventImpl._path.length - 1; i >= 0 && clearTargetsTupleIndex === -1; i--) {
if (eventImpl._path[i].target !== null) {
clearTargetsTupleIndex = i;
}
}
const clearTargetsTuple = eventImpl._path[clearTargetsTupleIndex];
clearTargets =
(isNode(clearTargetsTuple.target) && isShadowRoot(getRoot(clearTargetsTuple.target))) ||
(isNode(clearTargetsTuple.relatedTarget) && isShadowRoot(getRoot(clearTargetsTuple.relatedTarget)));
eventImpl.eventPhase = Event.CAPTURING_PHASE;
if (activationTarget !== null && activationTarget._legacyPreActivationBehavior) {
activationTarget._legacyPreActivationBehavior();
}
for (let i = eventImpl._path.length - 1; i >= 0; --i) {
const tuple = eventImpl._path[i];
if (tuple.target === null) {
invokeEventListeners(tuple, eventImpl);
}
}
for (let i = 0; i < eventImpl._path.length; i++) {
const tuple = eventImpl._path[i];
if (tuple.target !== null) {
eventImpl.eventPhase = Event.AT_TARGET;
} else {
eventImpl.eventPhase = Event.BUBBLING_PHASE;
}
if (
(eventImpl.eventPhase === Event.BUBBLING_PHASE && eventImpl.bubbles) ||
eventImpl.eventPhase === Event.AT_TARGET
) {
invokeEventListeners(tuple, eventImpl);
}
}
}
eventImpl.eventPhase = Event.NONE;
eventImpl.currentTarget = null;
eventImpl._path = [];
eventImpl._dispatchFlag = false;
eventImpl._stopPropagationFlag = false;
eventImpl._stopImmediatePropagationFlag = false;
eventImpl.eventPhase = Event.NONE;
eventImpl.currentTarget = null;
if (clearTargets) {
eventImpl.target = null;
eventImpl.relatedTarget = null;
}
if (activationTarget !== null) {
if (!eventImpl._canceledFlag) {
activationTarget._activationBehavior();
} else if (activationTarget._legacyCanceledActivationBehavior) {
activationTarget._legacyCanceledActivationBehavior();
}
}
return !eventImpl._canceledFlag;
}
}
@@ -147,41 +243,67 @@ module.exports = {
implementation: EventTargetImpl
};
function invokeEventListeners(listeners, target, eventImpl) {
// https://dom.spec.whatwg.org/#concept-event-listener-invoke
function invokeEventListeners(tuple, eventImpl) {
const tupleIndex = eventImpl._path.indexOf(tuple);
for (let i = tupleIndex; i >= 0; i--) {
const t = eventImpl._path[i];
if (t.target) {
eventImpl.target = t.target;
break;
}
}
eventImpl.relatedTarget = idlUtils.wrapperForImpl(tuple.relatedTarget);
if (eventImpl._stopPropagationFlag) {
return;
}
eventImpl.currentTarget = idlUtils.wrapperForImpl(tuple.item);
const listeners = tuple.item._eventListeners;
innerInvokeEventListeners(eventImpl, listeners);
}
// https://dom.spec.whatwg.org/#concept-event-listener-inner-invoke
function innerInvokeEventListeners(eventImpl, listeners) {
let found = false;
const { type, 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;
if (!listeners || !listeners[type]) {
return found;
}
// 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;
}
// Copy event listeners before iterating since the list can be modified during the iteration.
const handlers = listeners[type].slice();
const handlers = listeners.slice();
for (let i = 0; i < handlers.length; ++i) {
if (eventImpl._stopImmediatePropagationFlag) {
return;
for (let i = 0; i < handlers.length; i++) {
const listener = handlers[i];
const { capture, once, passive } = listener.options;
// Check if the event listener has been removed since the listeners has been cloned.
if (!listeners[type].includes(listener)) {
continue;
}
const listener = handlers[i];
const { capture, once/* , passive */ } = listener.options;
found = true;
if (listeners.indexOf(listener) === -1 ||
(eventImpl.eventPhase === Event.CAPTURING_PHASE && !capture) ||
(eventImpl.eventPhase === Event.BUBBLING_PHASE && capture)) {
if (
(eventImpl.eventPhase === Event.CAPTURING_PHASE && !capture) ||
(eventImpl.eventPhase === Event.BUBBLING_PHASE && capture)
) {
continue;
}
if (once) {
listeners.splice(listeners.indexOf(listener), 1);
listeners[type].splice(listeners[type].indexOf(listener), 1);
}
if (passive) {
eventImpl._inPassiveListenerFlag = true;
}
try {
@@ -190,7 +312,7 @@ function invokeEventListeners(listeners, target, eventImpl) {
listener.callback.handleEvent(idlUtils.wrapperForImpl(eventImpl));
}
} else {
listener.callback.call(idlUtils.wrapperForImpl(eventImpl.currentTarget), idlUtils.wrapperForImpl(eventImpl));
listener.callback.call(eventImpl.currentTarget, idlUtils.wrapperForImpl(eventImpl));
}
} catch (e) {
let window = null;
@@ -210,7 +332,15 @@ function invokeEventListeners(listeners, target, eventImpl) {
}
// Errors in window-less documents just get swallowed... can you think of anything better?
}
eventImpl._inPassiveListenerFlag = false;
if (eventImpl._stopImmediatePropagationFlag) {
return found;
}
}
return found;
}
/**
@@ -241,3 +371,19 @@ function normalizeEventHandlerOptions(options, defaultBoolKeys) {
return returnValue;
}
// https://dom.spec.whatwg.org/#concept-event-path-append
function appendToEventPath(eventImpl, target, targetOverride, relatedTarget, touchTargets, slotInClosedTree) {
const itemInShadowTree = isNode(target) && isShadowRoot(getRoot(target));
const rootOfClosedTree = isShadowRoot(target) && target.mode === "closed";
eventImpl._path.push({
item: target,
itemInShadowTree,
target: targetOverride,
relatedTarget,
touchTargets,
rootOfClosedTree,
slotInClosedTree
});
}

View File

@@ -0,0 +1,23 @@
"use strict";
const UIEventImpl = require("./UIEvent-impl").implementation;
const InputEventInit = require("../generated/InputEventInit");
// https://w3c.github.io/uievents/#interface-inputevent
class InputEventImpl extends UIEventImpl {
initInputEvent(type, bubbles, cancelable, data, isComposing) {
if (this._dispatchFlag) {
return;
}
this.initUIEvent(type, bubbles, cancelable);
this.data = data;
this.isComposing = isComposing;
}
}
InputEventImpl.defaultInit = InputEventInit.convert(undefined);
module.exports = {
implementation: InputEventImpl
};

View 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
};

View File

@@ -7,6 +7,7 @@ const DOMException = require("domexception");
const EventTargetImpl = require("../events/EventTarget-impl").implementation;
const ProgressEvent = require("../generated/ProgressEvent");
const { setupForSimpleEventAccessors } = require("../helpers/create-event-accessor");
const { fireAnEvent } = require("../helpers/events");
const READY_STATES = Object.freeze({
EMPTY: 0,
@@ -58,8 +59,7 @@ class FileReaderImpl extends EventTargetImpl {
}
_fireProgressEvent(name, props) {
const event = ProgressEvent.createImpl([name, Object.assign({ bubbles: false, cancelable: false }, props)], {});
this.dispatchEvent(event);
fireAnEvent(name, this, ProgressEvent, props);
}
_readFile(file, format, encoding) {

View File

@@ -1,3 +0,0 @@
"use strict";
exports.formData = Symbol("entries");

View File

@@ -7,34 +7,20 @@ 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."
);
class AbortController {
constructor() {
return iface.setup(Object.create(new.target.prototype));
}
iface.setup(this);
}
abort() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
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();
}
return this[impl].abort();
};
Object.defineProperty(AbortController.prototype, "signal", {
get() {
get signal() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -42,19 +28,13 @@ module.exports = {
return utils.getSameObject(this, "signal", () => {
return utils.tryWrapperForImpl(this[impl]["signal"]);
});
},
enumerable: true,
configurable: true
}
}
Object.defineProperties(AbortController.prototype, {
abort: { enumerable: true },
signal: { enumerable: true },
[Symbol.toStringTag]: { value: "AbortController", 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);
@@ -81,8 +61,6 @@ module.exports = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -8,43 +8,28 @@ const EventTarget = require("./EventTarget.js");
module.exports = {
createInterface: function(defaultPrivateData = {}) {
function AbortSignal() {
throw new TypeError("Illegal constructor");
}
class AbortSignal extends EventTarget.interface {
constructor() {
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() {
get aborted() {
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() {
get onabort() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["onabort"]);
},
}
set(V) {
set onabort(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -52,19 +37,13 @@ module.exports = {
V = utils.tryImplForWrapper(V);
this[impl]["onabort"] = V;
},
enumerable: true,
configurable: true
}
}
Object.defineProperties(AbortSignal.prototype, {
aborted: { enumerable: true },
onabort: { enumerable: true },
[Symbol.toStringTag]: { value: "AbortSignal", 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);
@@ -93,8 +72,6 @@ module.exports = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -20,6 +20,18 @@ module.exports = {
ret[key] = false;
}
}
{
const key = "passive";
let value = obj === undefined || obj === null ? undefined : obj[key];
if (value !== undefined) {
value = conversions["boolean"](value, { context: context + " has member passive that" });
ret[key] = value;
} else {
ret[key] = false;
}
}
},
convert(obj, { context = "The provided value" } = {}) {

View 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 = "flatten";
let value = obj === undefined || obj === null ? undefined : obj[key];
if (value !== undefined) {
value = conversions["boolean"](value, { context: context + " has member flatten 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;
}
};

View File

@@ -5,92 +5,60 @@ const utils = require("./utils.js");
const impl = utils.implSymbol;
function Attr() {
throw new TypeError("Illegal constructor");
}
class Attr {
constructor() {
throw new TypeError("Illegal constructor");
}
Object.defineProperty(Attr, "prototype", {
value: Attr.prototype,
writable: false,
enumerable: false,
configurable: false
});
Object.defineProperty(Attr.prototype, "namespaceURI", {
get() {
get namespaceURI() {
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() {
get prefix() {
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() {
get localName() {
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() {
get name() {
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() {
get nodeName() {
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() {
get value() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["value"];
},
}
set(V) {
set value(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -98,22 +66,17 @@ Object.defineProperty(Attr.prototype, "value", {
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() {
get nodeValue() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["nodeValue"];
},
}
set(V) {
set nodeValue(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -124,22 +87,17 @@ Object.defineProperty(Attr.prototype, "nodeValue", {
});
this[impl]["nodeValue"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(Attr.prototype, "textContent", {
get() {
get textContent() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["textContent"];
},
}
set(V) {
set textContent(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -150,45 +108,37 @@ Object.defineProperty(Attr.prototype, "textContent", {
});
this[impl]["textContent"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(Attr.prototype, "ownerElement", {
get() {
get ownerElement() {
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() {
get specified() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["specified"];
},
enumerable: true,
configurable: true
}
}
Object.defineProperties(Attr.prototype, {
namespaceURI: { enumerable: true },
prefix: { enumerable: true },
localName: { enumerable: true },
name: { enumerable: true },
nodeName: { enumerable: true },
value: { enumerable: true },
nodeValue: { enumerable: true },
textContent: { enumerable: true },
ownerElement: { enumerable: true },
specified: { enumerable: true },
[Symbol.toStringTag]: { value: "Attr", 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
@@ -248,8 +198,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -5,37 +5,23 @@ const utils = require("./utils.js");
const impl = utils.implSymbol;
function BarProp() {
throw new TypeError("Illegal constructor");
}
class BarProp {
constructor() {
throw new TypeError("Illegal constructor");
}
Object.defineProperty(BarProp, "prototype", {
value: BarProp.prototype,
writable: false,
enumerable: false,
configurable: false
});
Object.defineProperty(BarProp.prototype, "visible", {
get() {
get visible() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["visible"];
},
enumerable: true,
configurable: true
}
}
Object.defineProperties(BarProp.prototype, {
visible: { enumerable: true },
[Symbol.toStringTag]: { value: "BarProp", 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
@@ -95,8 +81,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -6,122 +6,99 @@ 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"
});
class Blob {
constructor() {
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);
}
V.push(nextItem);
curArg = V;
}
curArg = V;
}
args.push(curArg);
}
args.push(curArg);
}
{
let curArg = arguments[1];
curArg = convertBlobPropertyBag(curArg, { context: "Failed to construct 'Blob': parameter 2" });
args.push(curArg);
{
let curArg = arguments[1];
curArg = convertBlobPropertyBag(curArg, { context: "Failed to construct 'Blob': parameter 2" });
args.push(curArg);
}
return iface.setup(Object.create(new.target.prototype), args);
}
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
});
slice() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
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
});
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);
}
args.push(curArg);
}
{
let curArg = arguments[2];
if (curArg !== undefined) {
curArg = conversions["DOMString"](curArg, { context: "Failed to execute 'slice' on 'Blob': parameter 3" });
{
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);
}
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));
}
return utils.tryWrapperForImpl(this[impl].slice(...args));
};
Object.defineProperty(Blob.prototype, "size", {
get() {
get size() {
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() {
get type() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["type"];
},
enumerable: true,
configurable: true
}
}
Object.defineProperties(Blob.prototype, {
slice: { enumerable: true },
size: { enumerable: true },
type: { enumerable: true },
[Symbol.toStringTag]: { value: "Blob", 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
@@ -181,8 +158,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -6,27 +6,14 @@ const utils = require("./utils.js");
const impl = utils.implSymbol;
const Text = require("./Text.js");
function CDATASection() {
throw new TypeError("Illegal constructor");
class CDATASection extends Text.interface {
constructor() {
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.defineProperties(CDATASection.prototype, {
[Symbol.toStringTag]: { value: "CDATASection", configurable: true }
});
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
@@ -88,8 +75,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -9,245 +9,235 @@ 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");
class CharacterData extends Node.interface {
constructor() {
throw new TypeError("Illegal constructor");
}
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)
});
substringData(offset, count) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
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)
});
if (arguments.length < 2) {
throw new TypeError(
"Failed to execute 'substringData' on 'CharacterData': 2 arguments required, but only " +
arguments.length +
" present."
);
}
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)
const args = [];
{
let curArg = arguments[0];
curArg = conversions["unsigned long"](curArg, {
context: "Failed to execute 'substringData' on 'CharacterData': parameter 1"
});
args.push(curArg);
}
args.push(curArg);
}
return this[impl].replaceWith(...args);
};
CharacterData.prototype.remove = function remove() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
{
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);
}
return this[impl].remove();
};
appendData(data) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
Object.defineProperty(CharacterData.prototype, "data", {
get() {
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);
}
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);
}
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);
}
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);
}
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);
}
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);
}
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);
}
remove() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl].remove();
}
get data() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["data"];
},
}
set(V) {
set data(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -258,58 +248,49 @@ Object.defineProperty(CharacterData.prototype, "data", {
});
this[impl]["data"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(CharacterData.prototype, "length", {
get() {
get length() {
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() {
get previousElementSibling() {
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() {
get nextElementSibling() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["nextElementSibling"]);
},
enumerable: true,
configurable: true
}
}
Object.defineProperties(CharacterData.prototype, {
substringData: { enumerable: true },
appendData: { enumerable: true },
insertData: { enumerable: true },
deleteData: { enumerable: true },
replaceData: { enumerable: true },
before: { enumerable: true },
after: { enumerable: true },
replaceWith: { enumerable: true },
remove: { enumerable: true },
data: { enumerable: true },
length: { enumerable: true },
previousElementSibling: { enumerable: true },
nextElementSibling: { enumerable: true },
[Symbol.toStringTag]: { value: "CharacterData", configurable: true },
[Symbol.unscopables]: { value: { before: true, after: true, replaceWith: true, remove: true }, 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
@@ -371,8 +352,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -6,101 +6,84 @@ const utils = require("./utils.js");
const isNode = require("./Node.js").is;
const impl = utils.implSymbol;
function ChildNode() {
throw new TypeError("Illegal constructor");
class ChildNode {
constructor() {
throw new TypeError("Illegal constructor");
}
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);
}
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);
}
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);
}
remove() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl].remove();
}
}
Object.defineProperty(ChildNode, "prototype", {
value: ChildNode.prototype,
writable: false,
enumerable: false,
configurable: false
Object.defineProperties(ChildNode.prototype, {
before: { enumerable: true },
after: { enumerable: true },
replaceWith: { enumerable: true },
remove: { enumerable: true },
[Symbol.toStringTag]: { value: "ChildNode", configurable: true },
[Symbol.unscopables]: { value: { before: true, after: true, replaceWith: true, remove: true }, configurable: true }
});
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
@@ -160,8 +143,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -7,90 +7,57 @@ 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."
);
class CloseEvent extends Event.interface {
constructor(type) {
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);
}
return iface.setup(Object.create(new.target.prototype), args);
}
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() {
get wasClean() {
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() {
get code() {
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() {
get reason() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["reason"];
},
enumerable: true,
configurable: true
}
}
Object.defineProperties(CloseEvent.prototype, {
wasClean: { enumerable: true },
code: { enumerable: true },
reason: { enumerable: true },
[Symbol.toStringTag]: { value: "CloseEvent", 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
@@ -152,8 +119,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -6,44 +6,22 @@ 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 = "";
class Comment extends CharacterData.interface {
constructor() {
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);
}
args.push(curArg);
return iface.setup(Object.create(new.target.prototype), args);
}
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
});
Object.defineProperties(Comment.prototype, { [Symbol.toStringTag]: { value: "Comment", 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
@@ -105,8 +83,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -7,133 +7,109 @@ 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;
class CompositionEvent extends UIEvent.interface {
constructor(type) {
if (arguments.length < 1) {
throw new TypeError(
"Failed to construct 'CompositionEvent': 1 argument required, but only " + arguments.length + " present."
);
}
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;
const args = [];
{
let curArg = arguments[0];
curArg = conversions["DOMString"](curArg, { context: "Failed to construct 'CompositionEvent': parameter 1" });
args.push(curArg);
}
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;
{
let curArg = arguments[1];
curArg = convertCompositionEventInit(curArg, { context: "Failed to construct 'CompositionEvent': parameter 2" });
args.push(curArg);
}
args.push(curArg);
return iface.setup(Object.create(new.target.prototype), args);
}
{
let curArg = arguments[4];
if (curArg !== undefined) {
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 5"
context: "Failed to execute 'initCompositionEvent' on 'CompositionEvent': parameter 1"
});
} else {
curArg = "";
args.push(curArg);
}
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);
}
return this[impl].initCompositionEvent(...args);
};
Object.defineProperty(CompositionEvent.prototype, "data", {
get() {
get data() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["data"];
},
enumerable: true,
configurable: true
}
}
Object.defineProperties(CompositionEvent.prototype, {
initCompositionEvent: { enumerable: true },
data: { enumerable: true },
[Symbol.toStringTag]: { value: "CompositionEvent", 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
@@ -195,8 +171,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -7,120 +7,96 @@ 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;
class CustomEvent extends Event.interface {
constructor(type) {
if (arguments.length < 1) {
throw new TypeError(
"Failed to construct 'CustomEvent': 1 argument required, but only " + arguments.length + " present."
);
}
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;
const args = [];
{
let curArg = arguments[0];
curArg = conversions["DOMString"](curArg, { context: "Failed to construct 'CustomEvent': parameter 1" });
args.push(curArg);
}
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;
{
let curArg = arguments[1];
curArg = convertCustomEventInit(curArg, { context: "Failed to construct 'CustomEvent': parameter 2" });
args.push(curArg);
}
args.push(curArg);
return iface.setup(Object.create(new.target.prototype), args);
}
return this[impl].initCustomEvent(...args);
};
Object.defineProperty(CustomEvent.prototype, "detail", {
get() {
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);
}
get detail() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["detail"];
},
enumerable: true,
configurable: true
}
}
Object.defineProperties(CustomEvent.prototype, {
initCustomEvent: { enumerable: true },
detail: { enumerable: true },
[Symbol.toStringTag]: { value: "CustomEvent", 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
@@ -182,8 +158,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -6,136 +6,130 @@ 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");
class DOMImplementation {
constructor() {
throw new TypeError("Illegal constructor");
}
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"
});
createDocumentType(qualifiedName, publicId, systemId) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
args.push(curArg);
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));
}
{
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) {
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 = convertDocumentType(curArg, {
context: "Failed to execute 'createDocument' on 'DOMImplementation': parameter 3"
curArg = conversions["DOMString"](curArg, {
context: "Failed to execute 'createDocument' on 'DOMImplementation': parameter 1"
});
}
} else {
curArg = null;
args.push(curArg);
}
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) {
{
let curArg = arguments[1];
curArg = conversions["DOMString"](curArg, {
context: "Failed to execute 'createHTMLDocument' on 'DOMImplementation': parameter 1"
context: "Failed to execute 'createDocument' on 'DOMImplementation': parameter 2",
treatNullAsEmptyString: true
});
args.push(curArg);
}
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");
{
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));
}
return this[impl].hasFeature();
};
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));
}
Object.defineProperty(DOMImplementation.prototype, Symbol.toStringTag, {
value: "DOMImplementation",
writable: false,
enumerable: false,
configurable: true
hasFeature() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl].hasFeature();
}
}
Object.defineProperties(DOMImplementation.prototype, {
createDocumentType: { enumerable: true },
createDocument: { enumerable: true },
createHTMLDocument: { enumerable: true },
hasFeature: { enumerable: true },
[Symbol.toStringTag]: { value: "DOMImplementation", 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
@@ -195,8 +189,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -6,61 +6,45 @@ 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."
);
class DOMParser {
constructor() {
return iface.setup(Object.create(new.target.prototype));
}
iface.setup(this);
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", {
value: DOMParser.prototype,
writable: false,
enumerable: false,
configurable: false
Object.defineProperties(DOMParser.prototype, {
parseFromString: { enumerable: true },
[Symbol.toStringTag]: { value: "DOMParser", configurable: true }
});
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
@@ -120,8 +104,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -5,24 +5,14 @@ const utils = require("./utils.js");
const impl = utils.implSymbol;
function DOMStringMap() {
throw new TypeError("Illegal constructor");
class DOMStringMap {
constructor() {
throw new TypeError("Illegal constructor");
}
}
Object.defineProperty(DOMStringMap, "prototype", {
value: DOMStringMap.prototype,
writable: false,
enumerable: false,
configurable: false
Object.defineProperties(DOMStringMap.prototype, {
[Symbol.toStringTag]: { value: "DOMStringMap", configurable: true }
});
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
@@ -82,8 +72,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -5,198 +5,185 @@ 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");
class DOMTokenList {
constructor() {
throw new TypeError("Illegal constructor");
}
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" });
item(index) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
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 < 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);
}
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);
};
contains(token) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
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 '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);
}
if (arguments.length < 1) {
throw new TypeError(
"Failed to execute 'supports' on 'DOMTokenList': 1 argument required, but only " + arguments.length + " present."
);
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);
}
const args = [];
{
let curArg = arguments[0];
curArg = conversions["DOMString"](curArg, {
context: "Failed to execute 'supports' on 'DOMTokenList': parameter 1"
});
args.push(curArg);
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);
}
return this[impl].supports(...args);
};
DOMTokenList.prototype.entries = Array.prototype.entries;
DOMTokenList.prototype.keys = Array.prototype.keys;
DOMTokenList.prototype.values = Array.prototype[Symbol.iterator];
toggle(token) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
Object.defineProperty(DOMTokenList.prototype, "length", {
get() {
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);
}
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);
}
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);
}
get length() {
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() {
get value() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["value"];
},
}
set(V) {
set value(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -206,26 +193,33 @@ Object.defineProperty(DOMTokenList.prototype, "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
toString() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["value"];
}
}
Object.defineProperties(DOMTokenList.prototype, {
item: { enumerable: true },
contains: { enumerable: true },
add: { enumerable: true },
remove: { enumerable: true },
toggle: { enumerable: true },
replace: { enumerable: true },
supports: { enumerable: true },
length: { enumerable: true },
value: { enumerable: true },
toString: { enumerable: true },
[Symbol.toStringTag]: { value: "DOMTokenList", configurable: true },
[Symbol.iterator]: { value: Array.prototype[Symbol.iterator], configurable: true, writable: true },
keys: { value: Array.prototype.keys, configurable: true, enumerable: true, writable: true },
values: { value: Array.prototype[Symbol.iterator], configurable: true, enumerable: true, writable: true },
entries: { value: Array.prototype.entries, configurable: true, enumerable: true, writable: true },
forEach: { value: Array.prototype.forEach, configurable: true, enumerable: true, writable: 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
@@ -285,8 +279,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

File diff suppressed because it is too large Load Diff

View File

@@ -9,136 +9,119 @@ 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."
);
class DocumentFragment extends Node.interface {
constructor() {
return iface.setup(Object.create(new.target.prototype));
}
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)
});
getElementById(elementId) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
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)
});
if (arguments.length < 1) {
throw new TypeError(
"Failed to execute 'getElementById' on 'DocumentFragment': 1 argument required, but only " +
arguments.length +
" present."
);
}
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");
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));
}
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");
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);
}
if (arguments.length < 1) {
throw new TypeError(
"Failed to execute 'querySelectorAll' on 'DocumentFragment': 1 argument required, but only " +
arguments.length +
" present."
);
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);
}
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() {
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));
}
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));
}
get children() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -146,58 +129,45 @@ Object.defineProperty(DocumentFragment.prototype, "children", {
return utils.getSameObject(this, "children", () => {
return utils.tryWrapperForImpl(this[impl]["children"]);
});
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(DocumentFragment.prototype, "firstElementChild", {
get() {
get firstElementChild() {
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() {
get lastElementChild() {
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() {
get childElementCount() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["childElementCount"];
},
enumerable: true,
configurable: true
}
}
Object.defineProperties(DocumentFragment.prototype, {
getElementById: { enumerable: true },
prepend: { enumerable: true },
append: { enumerable: true },
querySelector: { enumerable: true },
querySelectorAll: { enumerable: true },
children: { enumerable: true },
firstElementChild: { enumerable: true },
lastElementChild: { enumerable: true },
childElementCount: { enumerable: true },
[Symbol.toStringTag]: { value: "DocumentFragment", configurable: true },
[Symbol.unscopables]: { value: { prepend: true, append: true }, 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
@@ -259,8 +229,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -8,131 +8,111 @@ 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");
class DocumentType extends Node.interface {
constructor() {
throw new TypeError("Illegal constructor");
}
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)
});
before() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
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)
});
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);
}
args.push(curArg);
return this[impl].before(...args);
}
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)
});
after() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
args.push(curArg);
}
return this[impl].replaceWith(...args);
};
DocumentType.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];
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);
}
return this[impl].remove();
};
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);
}
Object.defineProperty(DocumentType.prototype, "name", {
get() {
remove() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl].remove();
}
get name() {
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() {
get publicId() {
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() {
get systemId() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["systemId"];
},
enumerable: true,
configurable: true
}
}
Object.defineProperties(DocumentType.prototype, {
before: { enumerable: true },
after: { enumerable: true },
replaceWith: { enumerable: true },
remove: { enumerable: true },
name: { enumerable: true },
publicId: { enumerable: true },
systemId: { enumerable: true },
[Symbol.toStringTag]: { value: "DocumentType", configurable: true },
[Symbol.unscopables]: { value: { before: true, after: true, replaceWith: true, remove: true }, 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
@@ -194,8 +174,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

File diff suppressed because it is too large Load Diff

View File

@@ -5,19 +5,12 @@ const utils = require("./utils.js");
const impl = utils.implSymbol;
function ElementCSSInlineStyle() {
throw new TypeError("Illegal constructor");
}
class ElementCSSInlineStyle {
constructor() {
throw new TypeError("Illegal constructor");
}
Object.defineProperty(ElementCSSInlineStyle, "prototype", {
value: ElementCSSInlineStyle.prototype,
writable: false,
enumerable: false,
configurable: false
});
Object.defineProperty(ElementCSSInlineStyle.prototype, "style", {
get() {
get style() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -25,27 +18,20 @@ Object.defineProperty(ElementCSSInlineStyle.prototype, "style", {
return utils.getSameObject(this, "style", () => {
return utils.tryWrapperForImpl(this[impl]["style"]);
});
},
}
set(V) {
set style(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
this.style.cssText = V;
},
enumerable: true,
configurable: true
}
}
Object.defineProperties(ElementCSSInlineStyle.prototype, {
style: { enumerable: true },
[Symbol.toStringTag]: { value: "ElementCSSInlineStyle", 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
@@ -105,8 +91,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -5,24 +5,14 @@ const utils = require("./utils.js");
const impl = utils.implSymbol;
function ElementContentEditable() {
throw new TypeError("Illegal constructor");
class ElementContentEditable {
constructor() {
throw new TypeError("Illegal constructor");
}
}
Object.defineProperty(ElementContentEditable, "prototype", {
value: ElementContentEditable.prototype,
writable: false,
enumerable: false,
configurable: false
Object.defineProperties(ElementContentEditable.prototype, {
[Symbol.toStringTag]: { value: "ElementContentEditable", configurable: true }
});
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
@@ -82,8 +72,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -7,116 +7,75 @@ 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."
);
class ErrorEvent extends Event.interface {
constructor(type) {
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);
}
return iface.setup(Object.create(new.target.prototype), args);
}
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() {
get message() {
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() {
get filename() {
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() {
get lineno() {
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() {
get colno() {
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() {
get error() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["error"];
},
enumerable: true,
configurable: true
}
}
Object.defineProperties(ErrorEvent.prototype, {
message: { enumerable: true },
filename: { enumerable: true },
lineno: { enumerable: true },
colno: { enumerable: true },
error: { enumerable: true },
[Symbol.toStringTag]: { value: "ErrorEvent", configurable: true }
});
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
@@ -178,8 +137,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -6,175 +6,145 @@ 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;
class Event {
constructor(type) {
if (arguments.length < 1) {
throw new TypeError(
"Failed to construct 'Event': 1 argument required, but only " + arguments.length + " present."
);
}
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;
const args = [];
{
let curArg = arguments[0];
curArg = conversions["DOMString"](curArg, { context: "Failed to construct 'Event': parameter 1" });
args.push(curArg);
}
args.push(curArg);
{
let curArg = arguments[1];
curArg = convertEventInit(curArg, { context: "Failed to construct 'Event': parameter 2" });
args.push(curArg);
}
return iface.setup(Object.create(new.target.prototype), args);
}
return this[impl].initEvent(...args);
};
Object.defineProperty(Event.prototype, "type", {
get() {
composedPath() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl].composedPath());
}
stopPropagation() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl].stopPropagation();
}
stopImmediatePropagation() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl].stopImmediatePropagation();
}
preventDefault() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl].preventDefault();
}
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);
}
get type() {
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() {
get target() {
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() {
get srcElement() {
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() {
get currentTarget() {
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() {
get eventPhase() {
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() {
get cancelBubble() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["cancelBubble"];
},
}
set(V) {
set cancelBubble(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -184,48 +154,33 @@ Object.defineProperty(Event.prototype, "cancelBubble", {
});
this[impl]["cancelBubble"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(Event.prototype, "bubbles", {
get() {
get bubbles() {
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() {
get cancelable() {
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() {
get returnValue() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["returnValue"];
},
}
set(V) {
set returnValue(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -235,81 +190,62 @@ Object.defineProperty(Event.prototype, "returnValue", {
});
this[impl]["returnValue"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(Event.prototype, "defaultPrevented", {
get() {
get defaultPrevented() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["defaultPrevented"];
},
}
enumerable: true,
configurable: true
});
get composed() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
Object.defineProperty(Event.prototype, "timeStamp", {
get() {
return this[impl]["composed"];
}
get timeStamp() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["timeStamp"];
},
enumerable: true,
configurable: true
}
}
Object.defineProperties(Event.prototype, {
composedPath: { enumerable: true },
stopPropagation: { enumerable: true },
stopImmediatePropagation: { enumerable: true },
preventDefault: { enumerable: true },
initEvent: { enumerable: true },
type: { enumerable: true },
target: { enumerable: true },
srcElement: { enumerable: true },
currentTarget: { enumerable: true },
eventPhase: { enumerable: true },
cancelBubble: { enumerable: true },
bubbles: { enumerable: true },
cancelable: { enumerable: true },
returnValue: { enumerable: true },
defaultPrevented: { enumerable: true },
composed: { enumerable: true },
timeStamp: { enumerable: true },
[Symbol.toStringTag]: { value: "Event", configurable: true },
NONE: { value: 0, enumerable: true },
CAPTURING_PHASE: { value: 1, enumerable: true },
AT_TARGET: { value: 2, enumerable: true },
BUBBLING_PHASE: { value: 3, enumerable: true }
});
Object.defineProperty(Event, "NONE", {
value: 0,
enumerable: true
Object.defineProperties(Event, {
NONE: { value: 0, enumerable: true },
CAPTURING_PHASE: { value: 1, enumerable: true },
AT_TARGET: { value: 2, enumerable: true },
BUBBLING_PHASE: { value: 3, enumerable: true }
});
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
@@ -361,18 +297,20 @@ const iface = {
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
Object.defineProperty(obj, "isTrusted", {
get() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
Object.defineProperties(
obj,
utils.getOwnPropertyDescriptors({
get isTrusted() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return obj[impl]["isTrusted"];
}
})
);
return obj[impl]["isTrusted"];
},
enumerable: true,
configurable: false
});
Object.defineProperties(obj, { isTrusted: { configurable: false } });
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
@@ -382,8 +320,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -28,6 +28,18 @@ module.exports = {
ret[key] = false;
}
}
{
const key = "composed";
let value = obj === undefined || obj === null ? undefined : obj[key];
if (value !== undefined) {
value = conversions["boolean"](value, { context: context + " has member composed that" });
ret[key] = value;
} else {
ret[key] = false;
}
}
},
convert(obj, { context = "The provided value" } = {}) {

View File

@@ -8,162 +8,148 @@ 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."
);
class EventTarget {
constructor() {
return iface.setup(Object.create(new.target.prototype));
}
iface.setup(this);
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);
}
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);
}
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", {
value: EventTarget.prototype,
writable: false,
enumerable: false,
configurable: false
Object.defineProperties(EventTarget.prototype, {
addEventListener: { enumerable: true },
removeEventListener: { enumerable: true },
dispatchEvent: { enumerable: true },
[Symbol.toStringTag]: { value: "EventTarget", configurable: true }
});
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
@@ -223,8 +209,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -5,40 +5,32 @@ const utils = require("./utils.js");
const impl = utils.implSymbol;
function External() {
throw new TypeError("Illegal constructor");
class External {
constructor() {
throw new TypeError("Illegal constructor");
}
AddSearchProvider() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl].AddSearchProvider();
}
IsSearchProviderInstalled() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl].IsSearchProviderInstalled();
}
}
Object.defineProperty(External, "prototype", {
value: External.prototype,
writable: false,
enumerable: false,
configurable: false
Object.defineProperties(External.prototype, {
AddSearchProvider: { enumerable: true },
IsSearchProviderInstalled: { enumerable: true },
[Symbol.toStringTag]: { value: "External", configurable: true }
});
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
@@ -98,8 +90,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -8,97 +8,71 @@ 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;
class File extends Blob.interface {
constructor(fileBits, fileName) {
if (arguments.length < 2) {
throw new TypeError(
"Failed to construct 'File': 2 arguments required, but only " + arguments.length + " present."
);
}
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);
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);
}
return iface.setup(Object.create(new.target.prototype), args);
}
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() {
get name() {
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() {
get lastModified() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["lastModified"];
},
enumerable: true,
configurable: true
}
}
Object.defineProperties(File.prototype, {
name: { enumerable: true },
lastModified: { enumerable: true },
[Symbol.toStringTag]: { value: "File", 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
@@ -160,8 +134,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -5,63 +5,44 @@ 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");
class FileList {
constructor() {
throw new TypeError("Illegal constructor");
}
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));
};
item(index) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
Object.defineProperty(FileList.prototype, "length", {
get() {
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));
}
get length() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["length"];
},
enumerable: true,
configurable: true
}
}
Object.defineProperties(FileList.prototype, {
item: { enumerable: true },
length: { enumerable: true },
[Symbol.toStringTag]: { value: "FileList", configurable: true },
[Symbol.iterator]: { value: Array.prototype[Symbol.iterator], configurable: true, writable: 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
@@ -121,8 +102,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -9,179 +9,149 @@ 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."
);
class FileReader extends EventTarget.interface {
constructor() {
return iface.setup(Object.create(new.target.prototype));
}
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"
});
readAsArrayBuffer(blob) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
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 '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);
}
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);
};
readAsBinaryString(blob) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
FileReader.prototype.abort = function abort() {
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);
}
return this[impl].abort();
};
readAsText(blob) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
Object.defineProperty(FileReader.prototype, "readyState", {
get() {
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);
}
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);
}
abort() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl].abort();
}
get readyState() {
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() {
get result() {
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() {
get error() {
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() {
get onloadstart() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["onloadstart"]);
},
}
set(V) {
set onloadstart(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -189,22 +159,17 @@ module.exports = {
V = utils.tryImplForWrapper(V);
this[impl]["onloadstart"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(FileReader.prototype, "onprogress", {
get() {
get onprogress() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["onprogress"]);
},
}
set(V) {
set onprogress(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -212,22 +177,17 @@ module.exports = {
V = utils.tryImplForWrapper(V);
this[impl]["onprogress"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(FileReader.prototype, "onload", {
get() {
get onload() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["onload"]);
},
}
set(V) {
set onload(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -235,22 +195,17 @@ module.exports = {
V = utils.tryImplForWrapper(V);
this[impl]["onload"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(FileReader.prototype, "onabort", {
get() {
get onabort() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["onabort"]);
},
}
set(V) {
set onabort(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -258,22 +213,17 @@ module.exports = {
V = utils.tryImplForWrapper(V);
this[impl]["onabort"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(FileReader.prototype, "onerror", {
get() {
get onerror() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["onerror"]);
},
}
set(V) {
set onerror(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -281,22 +231,17 @@ module.exports = {
V = utils.tryImplForWrapper(V);
this[impl]["onerror"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(FileReader.prototype, "onloadend", {
get() {
get onloadend() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["onloadend"]);
},
}
set(V) {
set onloadend(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -304,46 +249,33 @@ module.exports = {
V = utils.tryImplForWrapper(V);
this[impl]["onloadend"] = V;
},
enumerable: true,
configurable: true
}
}
Object.defineProperties(FileReader.prototype, {
readAsArrayBuffer: { enumerable: true },
readAsBinaryString: { enumerable: true },
readAsText: { enumerable: true },
readAsDataURL: { enumerable: true },
abort: { enumerable: true },
readyState: { enumerable: true },
result: { enumerable: true },
error: { enumerable: true },
onloadstart: { enumerable: true },
onprogress: { enumerable: true },
onload: { enumerable: true },
onabort: { enumerable: true },
onerror: { enumerable: true },
onloadend: { enumerable: true },
[Symbol.toStringTag]: { value: "FileReader", configurable: true },
EMPTY: { value: 0, enumerable: true },
LOADING: { value: 1, enumerable: true },
DONE: { value: 2, enumerable: true }
});
Object.defineProperty(FileReader, "EMPTY", {
value: 0,
enumerable: true
Object.defineProperties(FileReader, {
EMPTY: { value: 0, enumerable: true },
LOADING: { value: 1, enumerable: true },
DONE: { value: 2, 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);
@@ -372,8 +304,6 @@ module.exports = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -7,64 +7,39 @@ 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."
);
class FocusEvent extends UIEvent.interface {
constructor(type) {
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);
}
return iface.setup(Object.create(new.target.prototype), args);
}
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() {
get relatedTarget() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["relatedTarget"]);
},
enumerable: true,
configurable: true
}
}
Object.defineProperties(FocusEvent.prototype, {
relatedTarget: { enumerable: true },
[Symbol.toStringTag]: { value: "FocusEvent", 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
@@ -126,8 +101,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -42,291 +42,283 @@ const IteratorPrototype = Object.create(utils.IteratorPrototype, {
configurable: true
},
[Symbol.toStringTag]: {
value: "FormDataIterator",
writable: false,
enumerable: false,
value: "FormData Iterator",
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" });
class FormData {
constructor() {
const args = [];
{
let curArg = arguments[0];
if (curArg !== undefined) {
curArg = convertHTMLFormElement(curArg, { context: "Failed to construct 'FormData': parameter 1" });
}
args.push(curArg);
}
args.push(curArg);
return iface.setup(Object.create(new.target.prototype), args);
}
iface.setup(this, args);
}
append(name, value) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
Object.defineProperty(FormData, "prototype", {
value: FormData.prototype,
writable: false,
enumerable: false,
configurable: false
});
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);
}
Object.defineProperty(FormData.prototype, Symbol.iterator, {
writable: true,
enumerable: false,
configurable: true,
value: function entries() {
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);
}
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));
}
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));
}
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);
}
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);
}
keys() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return module.exports.createDefaultIterator(this, "key");
}
values() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return module.exports.createDefaultIterator(this, "value");
}
entries() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return module.exports.createDefaultIterator(this, "key+value");
}
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 'iterable': 1 argument required, " + "but only 0 present.");
}
if (typeof callback !== "function") {
throw new TypeError(
"Failed to execute 'forEach' on 'iterable': 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++;
}
}
}
Object.defineProperties(FormData.prototype, {
append: { enumerable: true },
delete: { enumerable: true },
get: { enumerable: true },
getAll: { enumerable: true },
has: { enumerable: true },
set: { enumerable: true },
keys: { enumerable: true },
values: { enumerable: true },
entries: { enumerable: true },
forEach: { enumerable: true },
[Symbol.toStringTag]: { value: "FormData", configurable: true },
[Symbol.iterator]: { value: FormData.prototype.entries, configurable: true, writable: true }
});
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
@@ -371,8 +363,6 @@ const iface = {
const iterator = Object.create(IteratorPrototype);
Object.defineProperty(iterator, utils.iterInternalSymbol, {
value: { target, kind, index: 0 },
writable: false,
enumerable: false,
configurable: true
});
return iterator;
@@ -397,8 +387,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

File diff suppressed because it is too large Load Diff

View File

@@ -7,31 +7,21 @@ const impl = utils.implSymbol;
const HTMLElement = require("./HTMLElement.js");
const HTMLHyperlinkElementUtils = require("./HTMLHyperlinkElementUtils.js");
function HTMLAnchorElement() {
throw new TypeError("Illegal constructor");
}
class HTMLAnchorElement extends HTMLElement.interface {
constructor() {
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() {
get target() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("target");
return value === null ? "" : value;
},
}
set(V) {
set target(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -41,23 +31,18 @@ Object.defineProperty(HTMLAnchorElement.prototype, "target", {
});
this.setAttribute("target", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAnchorElement.prototype, "download", {
get() {
get download() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("download");
return value === null ? "" : value;
},
}
set(V) {
set download(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -67,23 +52,18 @@ Object.defineProperty(HTMLAnchorElement.prototype, "download", {
});
this.setAttribute("download", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAnchorElement.prototype, "rel", {
get() {
get rel() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("rel");
return value === null ? "" : value;
},
}
set(V) {
set rel(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -93,23 +73,36 @@ Object.defineProperty(HTMLAnchorElement.prototype, "rel", {
});
this.setAttribute("rel", V);
},
}
enumerable: true,
configurable: true
});
get relList() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
Object.defineProperty(HTMLAnchorElement.prototype, "hreflang", {
get() {
return utils.getSameObject(this, "relList", () => {
return utils.tryWrapperForImpl(this[impl]["relList"]);
});
}
set relList(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
this.relList.value = V;
}
get hreflang() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("hreflang");
return value === null ? "" : value;
},
}
set(V) {
set hreflang(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -119,23 +112,18 @@ Object.defineProperty(HTMLAnchorElement.prototype, "hreflang", {
});
this.setAttribute("hreflang", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAnchorElement.prototype, "type", {
get() {
get type() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("type");
return value === null ? "" : value;
},
}
set(V) {
set type(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -145,22 +133,17 @@ Object.defineProperty(HTMLAnchorElement.prototype, "type", {
});
this.setAttribute("type", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAnchorElement.prototype, "text", {
get() {
get text() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["text"];
},
}
set(V) {
set text(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -170,23 +153,18 @@ Object.defineProperty(HTMLAnchorElement.prototype, "text", {
});
this[impl]["text"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAnchorElement.prototype, "coords", {
get() {
get coords() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("coords");
return value === null ? "" : value;
},
}
set(V) {
set coords(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -196,23 +174,18 @@ Object.defineProperty(HTMLAnchorElement.prototype, "coords", {
});
this.setAttribute("coords", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAnchorElement.prototype, "charset", {
get() {
get charset() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("charset");
return value === null ? "" : value;
},
}
set(V) {
set charset(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -222,23 +195,18 @@ Object.defineProperty(HTMLAnchorElement.prototype, "charset", {
});
this.setAttribute("charset", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAnchorElement.prototype, "name", {
get() {
get name() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("name");
return value === null ? "" : value;
},
}
set(V) {
set name(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -248,23 +216,18 @@ Object.defineProperty(HTMLAnchorElement.prototype, "name", {
});
this.setAttribute("name", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAnchorElement.prototype, "rev", {
get() {
get rev() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("rev");
return value === null ? "" : value;
},
}
set(V) {
set rev(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -274,23 +237,18 @@ Object.defineProperty(HTMLAnchorElement.prototype, "rev", {
});
this.setAttribute("rev", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAnchorElement.prototype, "shape", {
get() {
get shape() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("shape");
return value === null ? "" : value;
},
}
set(V) {
set shape(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -300,22 +258,17 @@ Object.defineProperty(HTMLAnchorElement.prototype, "shape", {
});
this.setAttribute("shape", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAnchorElement.prototype, "href", {
get() {
get href() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["href"];
},
}
set(V) {
set href(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -325,42 +278,32 @@ Object.defineProperty(HTMLAnchorElement.prototype, "href", {
});
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() {
toString() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["href"];
}
get origin() {
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() {
get protocol() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["protocol"];
},
}
set(V) {
set protocol(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -370,22 +313,17 @@ Object.defineProperty(HTMLAnchorElement.prototype, "protocol", {
});
this[impl]["protocol"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAnchorElement.prototype, "username", {
get() {
get username() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["username"];
},
}
set(V) {
set username(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -395,22 +333,17 @@ Object.defineProperty(HTMLAnchorElement.prototype, "username", {
});
this[impl]["username"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAnchorElement.prototype, "password", {
get() {
get password() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["password"];
},
}
set(V) {
set password(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -420,22 +353,17 @@ Object.defineProperty(HTMLAnchorElement.prototype, "password", {
});
this[impl]["password"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAnchorElement.prototype, "host", {
get() {
get host() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["host"];
},
}
set(V) {
set host(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -445,22 +373,17 @@ Object.defineProperty(HTMLAnchorElement.prototype, "host", {
});
this[impl]["host"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAnchorElement.prototype, "hostname", {
get() {
get hostname() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["hostname"];
},
}
set(V) {
set hostname(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -470,22 +393,17 @@ Object.defineProperty(HTMLAnchorElement.prototype, "hostname", {
});
this[impl]["hostname"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAnchorElement.prototype, "port", {
get() {
get port() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["port"];
},
}
set(V) {
set port(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -495,22 +413,17 @@ Object.defineProperty(HTMLAnchorElement.prototype, "port", {
});
this[impl]["port"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAnchorElement.prototype, "pathname", {
get() {
get pathname() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["pathname"];
},
}
set(V) {
set pathname(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -520,22 +433,17 @@ Object.defineProperty(HTMLAnchorElement.prototype, "pathname", {
});
this[impl]["pathname"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAnchorElement.prototype, "search", {
get() {
get search() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["search"];
},
}
set(V) {
set search(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -545,22 +453,17 @@ Object.defineProperty(HTMLAnchorElement.prototype, "search", {
});
this[impl]["search"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAnchorElement.prototype, "hash", {
get() {
get hash() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["hash"];
},
}
set(V) {
set hash(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -570,19 +473,35 @@ Object.defineProperty(HTMLAnchorElement.prototype, "hash", {
});
this[impl]["hash"] = V;
},
enumerable: true,
configurable: true
}
}
Object.defineProperties(HTMLAnchorElement.prototype, {
target: { enumerable: true },
download: { enumerable: true },
rel: { enumerable: true },
relList: { enumerable: true },
hreflang: { enumerable: true },
type: { enumerable: true },
text: { enumerable: true },
coords: { enumerable: true },
charset: { enumerable: true },
name: { enumerable: true },
rev: { enumerable: true },
shape: { enumerable: true },
href: { enumerable: true },
toString: { enumerable: true },
origin: { enumerable: true },
protocol: { enumerable: true },
username: { enumerable: true },
password: { enumerable: true },
host: { enumerable: true },
hostname: { enumerable: true },
port: { enumerable: true },
pathname: { enumerable: true },
search: { enumerable: true },
hash: { enumerable: true },
[Symbol.toStringTag]: { value: "HTMLAnchorElement", configurable: true }
});
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
@@ -644,8 +563,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -7,31 +7,21 @@ const impl = utils.implSymbol;
const HTMLElement = require("./HTMLElement.js");
const HTMLHyperlinkElementUtils = require("./HTMLHyperlinkElementUtils.js");
function HTMLAreaElement() {
throw new TypeError("Illegal constructor");
}
class HTMLAreaElement extends HTMLElement.interface {
constructor() {
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() {
get alt() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("alt");
return value === null ? "" : value;
},
}
set(V) {
set alt(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -41,23 +31,18 @@ Object.defineProperty(HTMLAreaElement.prototype, "alt", {
});
this.setAttribute("alt", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAreaElement.prototype, "coords", {
get() {
get coords() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("coords");
return value === null ? "" : value;
},
}
set(V) {
set coords(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -67,23 +52,18 @@ Object.defineProperty(HTMLAreaElement.prototype, "coords", {
});
this.setAttribute("coords", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAreaElement.prototype, "shape", {
get() {
get shape() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("shape");
return value === null ? "" : value;
},
}
set(V) {
set shape(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -93,23 +73,18 @@ Object.defineProperty(HTMLAreaElement.prototype, "shape", {
});
this.setAttribute("shape", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAreaElement.prototype, "target", {
get() {
get target() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("target");
return value === null ? "" : value;
},
}
set(V) {
set target(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -119,23 +94,18 @@ Object.defineProperty(HTMLAreaElement.prototype, "target", {
});
this.setAttribute("target", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAreaElement.prototype, "rel", {
get() {
get rel() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("rel");
return value === null ? "" : value;
},
}
set(V) {
set rel(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -145,22 +115,35 @@ Object.defineProperty(HTMLAreaElement.prototype, "rel", {
});
this.setAttribute("rel", V);
},
}
enumerable: true,
configurable: true
});
get relList() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
Object.defineProperty(HTMLAreaElement.prototype, "noHref", {
get() {
return utils.getSameObject(this, "relList", () => {
return utils.tryWrapperForImpl(this[impl]["relList"]);
});
}
set relList(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
this.relList.value = V;
}
get noHref() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this.hasAttribute("noHref");
},
}
set(V) {
set noHref(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -174,22 +157,17 @@ Object.defineProperty(HTMLAreaElement.prototype, "noHref", {
} else {
this.removeAttribute("noHref");
}
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAreaElement.prototype, "href", {
get() {
get href() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["href"];
},
}
set(V) {
set href(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -199,42 +177,32 @@ Object.defineProperty(HTMLAreaElement.prototype, "href", {
});
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() {
toString() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["href"];
}
get origin() {
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() {
get protocol() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["protocol"];
},
}
set(V) {
set protocol(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -244,22 +212,17 @@ Object.defineProperty(HTMLAreaElement.prototype, "protocol", {
});
this[impl]["protocol"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAreaElement.prototype, "username", {
get() {
get username() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["username"];
},
}
set(V) {
set username(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -269,22 +232,17 @@ Object.defineProperty(HTMLAreaElement.prototype, "username", {
});
this[impl]["username"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAreaElement.prototype, "password", {
get() {
get password() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["password"];
},
}
set(V) {
set password(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -294,22 +252,17 @@ Object.defineProperty(HTMLAreaElement.prototype, "password", {
});
this[impl]["password"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAreaElement.prototype, "host", {
get() {
get host() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["host"];
},
}
set(V) {
set host(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -319,22 +272,17 @@ Object.defineProperty(HTMLAreaElement.prototype, "host", {
});
this[impl]["host"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAreaElement.prototype, "hostname", {
get() {
get hostname() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["hostname"];
},
}
set(V) {
set hostname(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -344,22 +292,17 @@ Object.defineProperty(HTMLAreaElement.prototype, "hostname", {
});
this[impl]["hostname"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAreaElement.prototype, "port", {
get() {
get port() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["port"];
},
}
set(V) {
set port(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -369,22 +312,17 @@ Object.defineProperty(HTMLAreaElement.prototype, "port", {
});
this[impl]["port"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAreaElement.prototype, "pathname", {
get() {
get pathname() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["pathname"];
},
}
set(V) {
set pathname(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -394,22 +332,17 @@ Object.defineProperty(HTMLAreaElement.prototype, "pathname", {
});
this[impl]["pathname"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAreaElement.prototype, "search", {
get() {
get search() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["search"];
},
}
set(V) {
set search(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -419,22 +352,17 @@ Object.defineProperty(HTMLAreaElement.prototype, "search", {
});
this[impl]["search"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAreaElement.prototype, "hash", {
get() {
get hash() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["hash"];
},
}
set(V) {
set hash(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -444,19 +372,30 @@ Object.defineProperty(HTMLAreaElement.prototype, "hash", {
});
this[impl]["hash"] = V;
},
enumerable: true,
configurable: true
}
}
Object.defineProperties(HTMLAreaElement.prototype, {
alt: { enumerable: true },
coords: { enumerable: true },
shape: { enumerable: true },
target: { enumerable: true },
rel: { enumerable: true },
relList: { enumerable: true },
noHref: { enumerable: true },
href: { enumerable: true },
toString: { enumerable: true },
origin: { enumerable: true },
protocol: { enumerable: true },
username: { enumerable: true },
password: { enumerable: true },
host: { enumerable: true },
hostname: { enumerable: true },
port: { enumerable: true },
pathname: { enumerable: true },
search: { enumerable: true },
hash: { enumerable: true },
[Symbol.toStringTag]: { value: "HTMLAreaElement", configurable: true }
});
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
@@ -518,8 +457,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -6,27 +6,14 @@ const utils = require("./utils.js");
const impl = utils.implSymbol;
const HTMLMediaElement = require("./HTMLMediaElement.js");
function HTMLAudioElement() {
throw new TypeError("Illegal constructor");
class HTMLAudioElement extends HTMLMediaElement.interface {
constructor() {
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.defineProperties(HTMLAudioElement.prototype, {
[Symbol.toStringTag]: { value: "HTMLAudioElement", configurable: true }
});
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
@@ -88,8 +75,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -6,31 +6,21 @@ const utils = require("./utils.js");
const impl = utils.implSymbol;
const HTMLElement = require("./HTMLElement.js");
function HTMLBRElement() {
throw new TypeError("Illegal constructor");
}
class HTMLBRElement extends HTMLElement.interface {
constructor() {
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() {
get clear() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("clear");
return value === null ? "" : value;
},
}
set(V) {
set clear(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -40,19 +30,12 @@ Object.defineProperty(HTMLBRElement.prototype, "clear", {
});
this.setAttribute("clear", V);
},
enumerable: true,
configurable: true
}
}
Object.defineProperties(HTMLBRElement.prototype, {
clear: { enumerable: true },
[Symbol.toStringTag]: { value: "HTMLBRElement", 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
@@ -114,8 +97,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -6,30 +6,20 @@ const utils = require("./utils.js");
const impl = utils.implSymbol;
const HTMLElement = require("./HTMLElement.js");
function HTMLBaseElement() {
throw new TypeError("Illegal constructor");
}
class HTMLBaseElement extends HTMLElement.interface {
constructor() {
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() {
get href() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["href"];
},
}
set(V) {
set href(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -39,23 +29,18 @@ Object.defineProperty(HTMLBaseElement.prototype, "href", {
});
this[impl]["href"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLBaseElement.prototype, "target", {
get() {
get target() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("target");
return value === null ? "" : value;
},
}
set(V) {
set target(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -65,19 +50,13 @@ Object.defineProperty(HTMLBaseElement.prototype, "target", {
});
this.setAttribute("target", V);
},
enumerable: true,
configurable: true
}
}
Object.defineProperties(HTMLBaseElement.prototype, {
href: { enumerable: true },
target: { enumerable: true },
[Symbol.toStringTag]: { value: "HTMLBaseElement", 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
@@ -139,8 +118,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -7,31 +7,21 @@ const impl = utils.implSymbol;
const HTMLElement = require("./HTMLElement.js");
const WindowEventHandlers = require("./WindowEventHandlers.js");
function HTMLBodyElement() {
throw new TypeError("Illegal constructor");
}
class HTMLBodyElement extends HTMLElement.interface {
constructor() {
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() {
get text() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("text");
return value === null ? "" : value;
},
}
set(V) {
set text(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -42,23 +32,18 @@ Object.defineProperty(HTMLBodyElement.prototype, "text", {
});
this.setAttribute("text", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLBodyElement.prototype, "link", {
get() {
get link() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("link");
return value === null ? "" : value;
},
}
set(V) {
set link(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -69,23 +54,18 @@ Object.defineProperty(HTMLBodyElement.prototype, "link", {
});
this.setAttribute("link", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLBodyElement.prototype, "vLink", {
get() {
get vLink() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("vLink");
return value === null ? "" : value;
},
}
set(V) {
set vLink(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -96,23 +76,18 @@ Object.defineProperty(HTMLBodyElement.prototype, "vLink", {
});
this.setAttribute("vLink", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLBodyElement.prototype, "aLink", {
get() {
get aLink() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("aLink");
return value === null ? "" : value;
},
}
set(V) {
set aLink(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -123,23 +98,18 @@ Object.defineProperty(HTMLBodyElement.prototype, "aLink", {
});
this.setAttribute("aLink", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLBodyElement.prototype, "bgColor", {
get() {
get bgColor() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("bgColor");
return value === null ? "" : value;
},
}
set(V) {
set bgColor(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -150,23 +120,18 @@ Object.defineProperty(HTMLBodyElement.prototype, "bgColor", {
});
this.setAttribute("bgColor", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLBodyElement.prototype, "background", {
get() {
get background() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("background");
return value === null ? "" : value;
},
}
set(V) {
set background(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -176,22 +141,17 @@ Object.defineProperty(HTMLBodyElement.prototype, "background", {
});
this.setAttribute("background", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLBodyElement.prototype, "onafterprint", {
get() {
get onafterprint() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["onafterprint"]);
},
}
set(V) {
set onafterprint(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -199,22 +159,17 @@ Object.defineProperty(HTMLBodyElement.prototype, "onafterprint", {
V = utils.tryImplForWrapper(V);
this[impl]["onafterprint"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLBodyElement.prototype, "onbeforeprint", {
get() {
get onbeforeprint() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["onbeforeprint"]);
},
}
set(V) {
set onbeforeprint(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -222,22 +177,17 @@ Object.defineProperty(HTMLBodyElement.prototype, "onbeforeprint", {
V = utils.tryImplForWrapper(V);
this[impl]["onbeforeprint"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLBodyElement.prototype, "onbeforeunload", {
get() {
get onbeforeunload() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["onbeforeunload"]);
},
}
set(V) {
set onbeforeunload(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -245,22 +195,17 @@ Object.defineProperty(HTMLBodyElement.prototype, "onbeforeunload", {
V = utils.tryImplForWrapper(V);
this[impl]["onbeforeunload"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLBodyElement.prototype, "onhashchange", {
get() {
get onhashchange() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["onhashchange"]);
},
}
set(V) {
set onhashchange(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -268,22 +213,17 @@ Object.defineProperty(HTMLBodyElement.prototype, "onhashchange", {
V = utils.tryImplForWrapper(V);
this[impl]["onhashchange"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLBodyElement.prototype, "onlanguagechange", {
get() {
get onlanguagechange() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["onlanguagechange"]);
},
}
set(V) {
set onlanguagechange(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -291,22 +231,17 @@ Object.defineProperty(HTMLBodyElement.prototype, "onlanguagechange", {
V = utils.tryImplForWrapper(V);
this[impl]["onlanguagechange"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLBodyElement.prototype, "onmessage", {
get() {
get onmessage() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["onmessage"]);
},
}
set(V) {
set onmessage(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -314,22 +249,17 @@ Object.defineProperty(HTMLBodyElement.prototype, "onmessage", {
V = utils.tryImplForWrapper(V);
this[impl]["onmessage"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLBodyElement.prototype, "onmessageerror", {
get() {
get onmessageerror() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["onmessageerror"]);
},
}
set(V) {
set onmessageerror(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -337,22 +267,17 @@ Object.defineProperty(HTMLBodyElement.prototype, "onmessageerror", {
V = utils.tryImplForWrapper(V);
this[impl]["onmessageerror"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLBodyElement.prototype, "onoffline", {
get() {
get onoffline() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["onoffline"]);
},
}
set(V) {
set onoffline(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -360,22 +285,17 @@ Object.defineProperty(HTMLBodyElement.prototype, "onoffline", {
V = utils.tryImplForWrapper(V);
this[impl]["onoffline"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLBodyElement.prototype, "ononline", {
get() {
get ononline() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["ononline"]);
},
}
set(V) {
set ononline(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -383,22 +303,17 @@ Object.defineProperty(HTMLBodyElement.prototype, "ononline", {
V = utils.tryImplForWrapper(V);
this[impl]["ononline"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLBodyElement.prototype, "onpagehide", {
get() {
get onpagehide() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["onpagehide"]);
},
}
set(V) {
set onpagehide(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -406,22 +321,17 @@ Object.defineProperty(HTMLBodyElement.prototype, "onpagehide", {
V = utils.tryImplForWrapper(V);
this[impl]["onpagehide"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLBodyElement.prototype, "onpageshow", {
get() {
get onpageshow() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["onpageshow"]);
},
}
set(V) {
set onpageshow(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -429,22 +339,17 @@ Object.defineProperty(HTMLBodyElement.prototype, "onpageshow", {
V = utils.tryImplForWrapper(V);
this[impl]["onpageshow"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLBodyElement.prototype, "onpopstate", {
get() {
get onpopstate() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["onpopstate"]);
},
}
set(V) {
set onpopstate(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -452,22 +357,17 @@ Object.defineProperty(HTMLBodyElement.prototype, "onpopstate", {
V = utils.tryImplForWrapper(V);
this[impl]["onpopstate"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLBodyElement.prototype, "onrejectionhandled", {
get() {
get onrejectionhandled() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["onrejectionhandled"]);
},
}
set(V) {
set onrejectionhandled(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -475,22 +375,17 @@ Object.defineProperty(HTMLBodyElement.prototype, "onrejectionhandled", {
V = utils.tryImplForWrapper(V);
this[impl]["onrejectionhandled"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLBodyElement.prototype, "onstorage", {
get() {
get onstorage() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["onstorage"]);
},
}
set(V) {
set onstorage(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -498,22 +393,17 @@ Object.defineProperty(HTMLBodyElement.prototype, "onstorage", {
V = utils.tryImplForWrapper(V);
this[impl]["onstorage"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLBodyElement.prototype, "onunhandledrejection", {
get() {
get onunhandledrejection() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["onunhandledrejection"]);
},
}
set(V) {
set onunhandledrejection(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -521,22 +411,17 @@ Object.defineProperty(HTMLBodyElement.prototype, "onunhandledrejection", {
V = utils.tryImplForWrapper(V);
this[impl]["onunhandledrejection"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLBodyElement.prototype, "onunload", {
get() {
get onunload() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["onunload"]);
},
}
set(V) {
set onunload(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -544,19 +429,33 @@ Object.defineProperty(HTMLBodyElement.prototype, "onunload", {
V = utils.tryImplForWrapper(V);
this[impl]["onunload"] = V;
},
enumerable: true,
configurable: true
}
}
Object.defineProperties(HTMLBodyElement.prototype, {
text: { enumerable: true },
link: { enumerable: true },
vLink: { enumerable: true },
aLink: { enumerable: true },
bgColor: { enumerable: true },
background: { enumerable: true },
onafterprint: { enumerable: true },
onbeforeprint: { enumerable: true },
onbeforeunload: { enumerable: true },
onhashchange: { enumerable: true },
onlanguagechange: { enumerable: true },
onmessage: { enumerable: true },
onmessageerror: { enumerable: true },
onoffline: { enumerable: true },
ononline: { enumerable: true },
onpagehide: { enumerable: true },
onpageshow: { enumerable: true },
onpopstate: { enumerable: true },
onrejectionhandled: { enumerable: true },
onstorage: { enumerable: true },
onunhandledrejection: { enumerable: true },
onunload: { enumerable: true },
[Symbol.toStringTag]: { value: "HTMLBodyElement", configurable: true }
});
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
@@ -618,8 +517,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -6,69 +6,59 @@ 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");
class HTMLButtonElement extends HTMLElement.interface {
constructor() {
throw new TypeError("Illegal constructor");
}
return this[impl].checkValidity();
};
checkValidity() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
HTMLButtonElement.prototype.reportValidity = function reportValidity() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
return this[impl].checkValidity();
}
return this[impl].reportValidity();
};
reportValidity() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
HTMLButtonElement.prototype.setCustomValidity = function setCustomValidity(error) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
return this[impl].reportValidity();
}
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);
};
setCustomValidity(error) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
Object.defineProperty(HTMLButtonElement.prototype, "autofocus", {
get() {
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);
}
get autofocus() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this.hasAttribute("autofocus");
},
}
set(V) {
set autofocus(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -82,22 +72,17 @@ Object.defineProperty(HTMLButtonElement.prototype, "autofocus", {
} else {
this.removeAttribute("autofocus");
}
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLButtonElement.prototype, "disabled", {
get() {
get disabled() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this.hasAttribute("disabled");
},
}
set(V) {
set disabled(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -111,35 +96,25 @@ Object.defineProperty(HTMLButtonElement.prototype, "disabled", {
} else {
this.removeAttribute("disabled");
}
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLButtonElement.prototype, "form", {
get() {
get form() {
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() {
get formNoValidate() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this.hasAttribute("formNoValidate");
},
}
set(V) {
set formNoValidate(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -153,23 +128,18 @@ Object.defineProperty(HTMLButtonElement.prototype, "formNoValidate", {
} else {
this.removeAttribute("formNoValidate");
}
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLButtonElement.prototype, "formTarget", {
get() {
get formTarget() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("formTarget");
return value === null ? "" : value;
},
}
set(V) {
set formTarget(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -179,23 +149,18 @@ Object.defineProperty(HTMLButtonElement.prototype, "formTarget", {
});
this.setAttribute("formTarget", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLButtonElement.prototype, "name", {
get() {
get name() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("name");
return value === null ? "" : value;
},
}
set(V) {
set name(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -205,22 +170,17 @@ Object.defineProperty(HTMLButtonElement.prototype, "name", {
});
this.setAttribute("name", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLButtonElement.prototype, "type", {
get() {
get type() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["type"];
},
}
set(V) {
set type(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -230,23 +190,18 @@ Object.defineProperty(HTMLButtonElement.prototype, "type", {
});
this[impl]["type"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLButtonElement.prototype, "value", {
get() {
get value() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("value");
return value === null ? "" : value;
},
}
set(V) {
set value(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -256,58 +211,58 @@ Object.defineProperty(HTMLButtonElement.prototype, "value", {
});
this.setAttribute("value", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLButtonElement.prototype, "willValidate", {
get() {
get willValidate() {
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() {
get validity() {
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() {
get validationMessage() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["validationMessage"];
},
}
enumerable: true,
configurable: true
get labels() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["labels"]);
}
}
Object.defineProperties(HTMLButtonElement.prototype, {
checkValidity: { enumerable: true },
reportValidity: { enumerable: true },
setCustomValidity: { enumerable: true },
autofocus: { enumerable: true },
disabled: { enumerable: true },
form: { enumerable: true },
formNoValidate: { enumerable: true },
formTarget: { enumerable: true },
name: { enumerable: true },
type: { enumerable: true },
value: { enumerable: true },
willValidate: { enumerable: true },
validity: { enumerable: true },
validationMessage: { enumerable: true },
labels: { enumerable: true },
[Symbol.toStringTag]: { value: "HTMLButtonElement", configurable: true }
});
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
@@ -369,8 +324,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -6,125 +6,115 @@ 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");
class HTMLCanvasElement extends HTMLElement.interface {
constructor() {
throw new TypeError("Illegal constructor");
}
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));
};
getContext(contextId) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
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) {
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 'toDataURL' on 'HTMLCanvasElement': parameter 1"
context: "Failed to execute 'getContext' on 'HTMLCanvasElement': parameter 1"
});
args.push(curArg);
}
args.push(curArg);
}
{
let curArg = arguments[1];
if (curArg !== undefined) {
for (let i = 1; i < arguments.length; i++) {
let curArg = arguments[i];
curArg = conversions["any"](curArg, {
context: "Failed to execute 'toDataURL' on 'HTMLCanvasElement': parameter 2"
context: "Failed to execute 'getContext' on 'HTMLCanvasElement': parameter " + (i + 1)
});
args.push(curArg);
}
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");
return utils.tryWrapperForImpl(this[impl].getContext(...args));
}
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"
});
toDataURL() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
args.push(curArg);
}
{
let curArg = arguments[2];
if (curArg !== undefined) {
curArg = conversions["any"](curArg, {
context: "Failed to execute 'toBlob' on 'HTMLCanvasElement': parameter 3"
});
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);
}
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);
}
return this[impl].toBlob(...args);
};
Object.defineProperty(HTMLCanvasElement.prototype, "width", {
get() {
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);
}
get width() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["width"];
},
}
set(V) {
set width(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -134,22 +124,17 @@ Object.defineProperty(HTMLCanvasElement.prototype, "width", {
});
this[impl]["width"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLCanvasElement.prototype, "height", {
get() {
get height() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["height"];
},
}
set(V) {
set height(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -159,19 +144,16 @@ Object.defineProperty(HTMLCanvasElement.prototype, "height", {
});
this[impl]["height"] = V;
},
enumerable: true,
configurable: true
}
}
Object.defineProperties(HTMLCanvasElement.prototype, {
getContext: { enumerable: true },
toDataURL: { enumerable: true },
toBlob: { enumerable: true },
width: { enumerable: true },
height: { enumerable: true },
[Symbol.toStringTag]: { value: "HTMLCanvasElement", configurable: true }
});
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
@@ -233,8 +215,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -5,88 +5,70 @@ 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");
class HTMLCollection {
constructor() {
throw new TypeError("Illegal constructor");
}
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));
};
item(index) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
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 '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));
}
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));
};
namedItem(name) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
Object.defineProperty(HTMLCollection.prototype, "length", {
get() {
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));
}
get length() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["length"];
},
enumerable: true,
configurable: true
}
}
Object.defineProperties(HTMLCollection.prototype, {
item: { enumerable: true },
namedItem: { enumerable: true },
length: { enumerable: true },
[Symbol.toStringTag]: { value: "HTMLCollection", configurable: true },
[Symbol.iterator]: { value: Array.prototype[Symbol.iterator], configurable: true, writable: 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
@@ -146,8 +128,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -6,30 +6,20 @@ const utils = require("./utils.js");
const impl = utils.implSymbol;
const HTMLElement = require("./HTMLElement.js");
function HTMLDListElement() {
throw new TypeError("Illegal constructor");
}
class HTMLDListElement extends HTMLElement.interface {
constructor() {
throw new TypeError("Illegal constructor");
}
Object.setPrototypeOf(HTMLDListElement.prototype, HTMLElement.interface.prototype);
Object.setPrototypeOf(HTMLDListElement, HTMLElement.interface);
Object.defineProperty(HTMLDListElement, "prototype", {
value: HTMLDListElement.prototype,
writable: false,
enumerable: false,
configurable: false
});
Object.defineProperty(HTMLDListElement.prototype, "compact", {
get() {
get compact() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this.hasAttribute("compact");
},
}
set(V) {
set compact(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -43,19 +33,12 @@ Object.defineProperty(HTMLDListElement.prototype, "compact", {
} else {
this.removeAttribute("compact");
}
},
enumerable: true,
configurable: true
}
}
Object.defineProperties(HTMLDListElement.prototype, {
compact: { enumerable: true },
[Symbol.toStringTag]: { value: "HTMLDListElement", configurable: true }
});
Object.defineProperty(HTMLDListElement.prototype, Symbol.toStringTag, {
value: "HTMLDListElement",
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
@@ -117,8 +100,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -6,31 +6,21 @@ const utils = require("./utils.js");
const impl = utils.implSymbol;
const HTMLElement = require("./HTMLElement.js");
function HTMLDataElement() {
throw new TypeError("Illegal constructor");
}
class HTMLDataElement extends HTMLElement.interface {
constructor() {
throw new TypeError("Illegal constructor");
}
Object.setPrototypeOf(HTMLDataElement.prototype, HTMLElement.interface.prototype);
Object.setPrototypeOf(HTMLDataElement, HTMLElement.interface);
Object.defineProperty(HTMLDataElement, "prototype", {
value: HTMLDataElement.prototype,
writable: false,
enumerable: false,
configurable: false
});
Object.defineProperty(HTMLDataElement.prototype, "value", {
get() {
get value() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("value");
return value === null ? "" : value;
},
}
set(V) {
set value(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -40,19 +30,12 @@ Object.defineProperty(HTMLDataElement.prototype, "value", {
});
this.setAttribute("value", V);
},
enumerable: true,
configurable: true
}
}
Object.defineProperties(HTMLDataElement.prototype, {
value: { enumerable: true },
[Symbol.toStringTag]: { value: "HTMLDataElement", configurable: true }
});
Object.defineProperty(HTMLDataElement.prototype, Symbol.toStringTag, {
value: "HTMLDataElement",
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
@@ -114,8 +97,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -6,27 +6,14 @@ const utils = require("./utils.js");
const impl = utils.implSymbol;
const HTMLElement = require("./HTMLElement.js");
function HTMLDataListElement() {
throw new TypeError("Illegal constructor");
class HTMLDataListElement extends HTMLElement.interface {
constructor() {
throw new TypeError("Illegal constructor");
}
}
Object.setPrototypeOf(HTMLDataListElement.prototype, HTMLElement.interface.prototype);
Object.setPrototypeOf(HTMLDataListElement, HTMLElement.interface);
Object.defineProperty(HTMLDataListElement, "prototype", {
value: HTMLDataListElement.prototype,
writable: false,
enumerable: false,
configurable: false
Object.defineProperties(HTMLDataListElement.prototype, {
[Symbol.toStringTag]: { value: "HTMLDataListElement", configurable: true }
});
Object.defineProperty(HTMLDataListElement.prototype, Symbol.toStringTag, {
value: "HTMLDataListElement",
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
@@ -88,8 +75,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -6,30 +6,20 @@ const utils = require("./utils.js");
const impl = utils.implSymbol;
const HTMLElement = require("./HTMLElement.js");
function HTMLDetailsElement() {
throw new TypeError("Illegal constructor");
}
class HTMLDetailsElement extends HTMLElement.interface {
constructor() {
throw new TypeError("Illegal constructor");
}
Object.setPrototypeOf(HTMLDetailsElement.prototype, HTMLElement.interface.prototype);
Object.setPrototypeOf(HTMLDetailsElement, HTMLElement.interface);
Object.defineProperty(HTMLDetailsElement, "prototype", {
value: HTMLDetailsElement.prototype,
writable: false,
enumerable: false,
configurable: false
});
Object.defineProperty(HTMLDetailsElement.prototype, "open", {
get() {
get open() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this.hasAttribute("open");
},
}
set(V) {
set open(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -43,19 +33,12 @@ Object.defineProperty(HTMLDetailsElement.prototype, "open", {
} else {
this.removeAttribute("open");
}
},
enumerable: true,
configurable: true
}
}
Object.defineProperties(HTMLDetailsElement.prototype, {
open: { enumerable: true },
[Symbol.toStringTag]: { value: "HTMLDetailsElement", configurable: true }
});
Object.defineProperty(HTMLDetailsElement.prototype, Symbol.toStringTag, {
value: "HTMLDetailsElement",
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
@@ -117,8 +100,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -6,30 +6,20 @@ const utils = require("./utils.js");
const impl = utils.implSymbol;
const HTMLElement = require("./HTMLElement.js");
function HTMLDialogElement() {
throw new TypeError("Illegal constructor");
}
class HTMLDialogElement extends HTMLElement.interface {
constructor() {
throw new TypeError("Illegal constructor");
}
Object.setPrototypeOf(HTMLDialogElement.prototype, HTMLElement.interface.prototype);
Object.setPrototypeOf(HTMLDialogElement, HTMLElement.interface);
Object.defineProperty(HTMLDialogElement, "prototype", {
value: HTMLDialogElement.prototype,
writable: false,
enumerable: false,
configurable: false
});
Object.defineProperty(HTMLDialogElement.prototype, "open", {
get() {
get open() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this.hasAttribute("open");
},
}
set(V) {
set open(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -43,19 +33,12 @@ Object.defineProperty(HTMLDialogElement.prototype, "open", {
} else {
this.removeAttribute("open");
}
},
enumerable: true,
configurable: true
}
}
Object.defineProperties(HTMLDialogElement.prototype, {
open: { enumerable: true },
[Symbol.toStringTag]: { value: "HTMLDialogElement", configurable: true }
});
Object.defineProperty(HTMLDialogElement.prototype, Symbol.toStringTag, {
value: "HTMLDialogElement",
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
@@ -117,8 +100,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -6,30 +6,20 @@ const utils = require("./utils.js");
const impl = utils.implSymbol;
const HTMLElement = require("./HTMLElement.js");
function HTMLDirectoryElement() {
throw new TypeError("Illegal constructor");
}
class HTMLDirectoryElement extends HTMLElement.interface {
constructor() {
throw new TypeError("Illegal constructor");
}
Object.setPrototypeOf(HTMLDirectoryElement.prototype, HTMLElement.interface.prototype);
Object.setPrototypeOf(HTMLDirectoryElement, HTMLElement.interface);
Object.defineProperty(HTMLDirectoryElement, "prototype", {
value: HTMLDirectoryElement.prototype,
writable: false,
enumerable: false,
configurable: false
});
Object.defineProperty(HTMLDirectoryElement.prototype, "compact", {
get() {
get compact() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this.hasAttribute("compact");
},
}
set(V) {
set compact(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -43,19 +33,12 @@ Object.defineProperty(HTMLDirectoryElement.prototype, "compact", {
} else {
this.removeAttribute("compact");
}
},
enumerable: true,
configurable: true
}
}
Object.defineProperties(HTMLDirectoryElement.prototype, {
compact: { enumerable: true },
[Symbol.toStringTag]: { value: "HTMLDirectoryElement", configurable: true }
});
Object.defineProperty(HTMLDirectoryElement.prototype, Symbol.toStringTag, {
value: "HTMLDirectoryElement",
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
@@ -117,8 +100,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -6,31 +6,21 @@ const utils = require("./utils.js");
const impl = utils.implSymbol;
const HTMLElement = require("./HTMLElement.js");
function HTMLDivElement() {
throw new TypeError("Illegal constructor");
}
class HTMLDivElement extends HTMLElement.interface {
constructor() {
throw new TypeError("Illegal constructor");
}
Object.setPrototypeOf(HTMLDivElement.prototype, HTMLElement.interface.prototype);
Object.setPrototypeOf(HTMLDivElement, HTMLElement.interface);
Object.defineProperty(HTMLDivElement, "prototype", {
value: HTMLDivElement.prototype,
writable: false,
enumerable: false,
configurable: false
});
Object.defineProperty(HTMLDivElement.prototype, "align", {
get() {
get align() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("align");
return value === null ? "" : value;
},
}
set(V) {
set align(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -40,19 +30,12 @@ Object.defineProperty(HTMLDivElement.prototype, "align", {
});
this.setAttribute("align", V);
},
enumerable: true,
configurable: true
}
}
Object.defineProperties(HTMLDivElement.prototype, {
align: { enumerable: true },
[Symbol.toStringTag]: { value: "HTMLDivElement", configurable: true }
});
Object.defineProperty(HTMLDivElement.prototype, Symbol.toStringTag, {
value: "HTMLDivElement",
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
@@ -114,8 +97,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

File diff suppressed because it is too large Load Diff

View File

@@ -6,30 +6,20 @@ const utils = require("./utils.js");
const impl = utils.implSymbol;
const HTMLElement = require("./HTMLElement.js");
function HTMLEmbedElement() {
throw new TypeError("Illegal constructor");
}
class HTMLEmbedElement extends HTMLElement.interface {
constructor() {
throw new TypeError("Illegal constructor");
}
Object.setPrototypeOf(HTMLEmbedElement.prototype, HTMLElement.interface.prototype);
Object.setPrototypeOf(HTMLEmbedElement, HTMLElement.interface);
Object.defineProperty(HTMLEmbedElement, "prototype", {
value: HTMLEmbedElement.prototype,
writable: false,
enumerable: false,
configurable: false
});
Object.defineProperty(HTMLEmbedElement.prototype, "src", {
get() {
get src() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["src"];
},
}
set(V) {
set src(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -39,23 +29,18 @@ Object.defineProperty(HTMLEmbedElement.prototype, "src", {
});
this[impl]["src"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLEmbedElement.prototype, "type", {
get() {
get type() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("type");
return value === null ? "" : value;
},
}
set(V) {
set type(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -65,23 +50,18 @@ Object.defineProperty(HTMLEmbedElement.prototype, "type", {
});
this.setAttribute("type", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLEmbedElement.prototype, "width", {
get() {
get width() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("width");
return value === null ? "" : value;
},
}
set(V) {
set width(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -91,23 +71,18 @@ Object.defineProperty(HTMLEmbedElement.prototype, "width", {
});
this.setAttribute("width", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLEmbedElement.prototype, "height", {
get() {
get height() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("height");
return value === null ? "" : value;
},
}
set(V) {
set height(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -117,23 +92,18 @@ Object.defineProperty(HTMLEmbedElement.prototype, "height", {
});
this.setAttribute("height", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLEmbedElement.prototype, "align", {
get() {
get align() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("align");
return value === null ? "" : value;
},
}
set(V) {
set align(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -143,23 +113,18 @@ Object.defineProperty(HTMLEmbedElement.prototype, "align", {
});
this.setAttribute("align", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLEmbedElement.prototype, "name", {
get() {
get name() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("name");
return value === null ? "" : value;
},
}
set(V) {
set name(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -169,19 +134,17 @@ Object.defineProperty(HTMLEmbedElement.prototype, "name", {
});
this.setAttribute("name", V);
},
enumerable: true,
configurable: true
}
}
Object.defineProperties(HTMLEmbedElement.prototype, {
src: { enumerable: true },
type: { enumerable: true },
width: { enumerable: true },
height: { enumerable: true },
align: { enumerable: true },
name: { enumerable: true },
[Symbol.toStringTag]: { value: "HTMLEmbedElement", configurable: true }
});
Object.defineProperty(HTMLEmbedElement.prototype, Symbol.toStringTag, {
value: "HTMLEmbedElement",
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
@@ -243,8 +206,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -6,69 +6,59 @@ const utils = require("./utils.js");
const impl = utils.implSymbol;
const HTMLElement = require("./HTMLElement.js");
function HTMLFieldSetElement() {
throw new TypeError("Illegal constructor");
}
Object.setPrototypeOf(HTMLFieldSetElement.prototype, HTMLElement.interface.prototype);
Object.setPrototypeOf(HTMLFieldSetElement, HTMLElement.interface);
Object.defineProperty(HTMLFieldSetElement, "prototype", {
value: HTMLFieldSetElement.prototype,
writable: false,
enumerable: false,
configurable: false
});
HTMLFieldSetElement.prototype.checkValidity = function checkValidity() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
class HTMLFieldSetElement extends HTMLElement.interface {
constructor() {
throw new TypeError("Illegal constructor");
}
return this[impl].checkValidity();
};
checkValidity() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
HTMLFieldSetElement.prototype.reportValidity = function reportValidity() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
return this[impl].checkValidity();
}
return this[impl].reportValidity();
};
reportValidity() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
HTMLFieldSetElement.prototype.setCustomValidity = function setCustomValidity(error) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
return this[impl].reportValidity();
}
if (arguments.length < 1) {
throw new TypeError(
"Failed to execute 'setCustomValidity' on 'HTMLFieldSetElement': 1 argument required, but only " +
arguments.length +
" present."
);
}
const args = [];
{
let curArg = arguments[0];
curArg = conversions["DOMString"](curArg, {
context: "Failed to execute 'setCustomValidity' on 'HTMLFieldSetElement': parameter 1"
});
args.push(curArg);
}
return this[impl].setCustomValidity(...args);
};
setCustomValidity(error) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
Object.defineProperty(HTMLFieldSetElement.prototype, "disabled", {
get() {
if (arguments.length < 1) {
throw new TypeError(
"Failed to execute 'setCustomValidity' on 'HTMLFieldSetElement': 1 argument required, but only " +
arguments.length +
" present."
);
}
const args = [];
{
let curArg = arguments[0];
curArg = conversions["DOMString"](curArg, {
context: "Failed to execute 'setCustomValidity' on 'HTMLFieldSetElement': parameter 1"
});
args.push(curArg);
}
return this[impl].setCustomValidity(...args);
}
get disabled() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this.hasAttribute("disabled");
},
}
set(V) {
set disabled(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -82,36 +72,26 @@ Object.defineProperty(HTMLFieldSetElement.prototype, "disabled", {
} else {
this.removeAttribute("disabled");
}
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFieldSetElement.prototype, "form", {
get() {
get form() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["form"]);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFieldSetElement.prototype, "name", {
get() {
get name() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("name");
return value === null ? "" : value;
},
}
set(V) {
set name(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -121,27 +101,35 @@ Object.defineProperty(HTMLFieldSetElement.prototype, "name", {
});
this.setAttribute("name", V);
},
}
enumerable: true,
configurable: true
});
get type() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
Object.defineProperty(HTMLFieldSetElement.prototype, "willValidate", {
get() {
return this[impl]["type"];
}
get elements() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.getSameObject(this, "elements", () => {
return utils.tryWrapperForImpl(this[impl]["elements"]);
});
}
get willValidate() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["willValidate"];
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFieldSetElement.prototype, "validity", {
get() {
get validity() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -149,32 +137,30 @@ Object.defineProperty(HTMLFieldSetElement.prototype, "validity", {
return utils.getSameObject(this, "validity", () => {
return utils.tryWrapperForImpl(this[impl]["validity"]);
});
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFieldSetElement.prototype, "validationMessage", {
get() {
get validationMessage() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["validationMessage"];
},
enumerable: true,
configurable: true
}
}
Object.defineProperties(HTMLFieldSetElement.prototype, {
checkValidity: { enumerable: true },
reportValidity: { enumerable: true },
setCustomValidity: { enumerable: true },
disabled: { enumerable: true },
form: { enumerable: true },
name: { enumerable: true },
type: { enumerable: true },
elements: { enumerable: true },
willValidate: { enumerable: true },
validity: { enumerable: true },
validationMessage: { enumerable: true },
[Symbol.toStringTag]: { value: "HTMLFieldSetElement", configurable: true }
});
Object.defineProperty(HTMLFieldSetElement.prototype, Symbol.toStringTag, {
value: "HTMLFieldSetElement",
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
@@ -236,8 +222,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -6,31 +6,21 @@ const utils = require("./utils.js");
const impl = utils.implSymbol;
const HTMLElement = require("./HTMLElement.js");
function HTMLFontElement() {
throw new TypeError("Illegal constructor");
}
class HTMLFontElement extends HTMLElement.interface {
constructor() {
throw new TypeError("Illegal constructor");
}
Object.setPrototypeOf(HTMLFontElement.prototype, HTMLElement.interface.prototype);
Object.setPrototypeOf(HTMLFontElement, HTMLElement.interface);
Object.defineProperty(HTMLFontElement, "prototype", {
value: HTMLFontElement.prototype,
writable: false,
enumerable: false,
configurable: false
});
Object.defineProperty(HTMLFontElement.prototype, "color", {
get() {
get color() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("color");
return value === null ? "" : value;
},
}
set(V) {
set color(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -41,23 +31,18 @@ Object.defineProperty(HTMLFontElement.prototype, "color", {
});
this.setAttribute("color", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFontElement.prototype, "face", {
get() {
get face() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("face");
return value === null ? "" : value;
},
}
set(V) {
set face(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -67,23 +52,18 @@ Object.defineProperty(HTMLFontElement.prototype, "face", {
});
this.setAttribute("face", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFontElement.prototype, "size", {
get() {
get size() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("size");
return value === null ? "" : value;
},
}
set(V) {
set size(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -93,19 +73,14 @@ Object.defineProperty(HTMLFontElement.prototype, "size", {
});
this.setAttribute("size", V);
},
enumerable: true,
configurable: true
}
}
Object.defineProperties(HTMLFontElement.prototype, {
color: { enumerable: true },
face: { enumerable: true },
size: { enumerable: true },
[Symbol.toStringTag]: { value: "HTMLFontElement", configurable: true }
});
Object.defineProperty(HTMLFontElement.prototype, Symbol.toStringTag, {
value: "HTMLFontElement",
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
@@ -167,8 +142,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -6,63 +6,53 @@ const utils = require("./utils.js");
const impl = utils.implSymbol;
const HTMLElement = require("./HTMLElement.js");
function HTMLFormElement() {
throw new TypeError("Illegal constructor");
}
Object.setPrototypeOf(HTMLFormElement.prototype, HTMLElement.interface.prototype);
Object.setPrototypeOf(HTMLFormElement, HTMLElement.interface);
Object.defineProperty(HTMLFormElement, "prototype", {
value: HTMLFormElement.prototype,
writable: false,
enumerable: false,
configurable: false
});
HTMLFormElement.prototype.submit = function submit() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
class HTMLFormElement extends HTMLElement.interface {
constructor() {
throw new TypeError("Illegal constructor");
}
return this[impl].submit();
};
submit() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
HTMLFormElement.prototype.reset = function reset() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
return this[impl].submit();
}
return this[impl].reset();
};
reset() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
HTMLFormElement.prototype.checkValidity = function checkValidity() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
return this[impl].reset();
}
return this[impl].checkValidity();
};
checkValidity() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
HTMLFormElement.prototype.reportValidity = function reportValidity() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
return this[impl].checkValidity();
}
return this[impl].reportValidity();
};
reportValidity() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
Object.defineProperty(HTMLFormElement.prototype, "acceptCharset", {
get() {
return this[impl].reportValidity();
}
get acceptCharset() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("accept-charset");
return value === null ? "" : value;
},
}
set(V) {
set acceptCharset(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -72,22 +62,17 @@ Object.defineProperty(HTMLFormElement.prototype, "acceptCharset", {
});
this.setAttribute("accept-charset", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFormElement.prototype, "action", {
get() {
get action() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["action"];
},
}
set(V) {
set action(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -97,22 +82,17 @@ Object.defineProperty(HTMLFormElement.prototype, "action", {
});
this[impl]["action"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFormElement.prototype, "enctype", {
get() {
get enctype() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["enctype"];
},
}
set(V) {
set enctype(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -122,22 +102,17 @@ Object.defineProperty(HTMLFormElement.prototype, "enctype", {
});
this[impl]["enctype"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFormElement.prototype, "method", {
get() {
get method() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["method"];
},
}
set(V) {
set method(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -147,23 +122,18 @@ Object.defineProperty(HTMLFormElement.prototype, "method", {
});
this[impl]["method"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFormElement.prototype, "name", {
get() {
get name() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("name");
return value === null ? "" : value;
},
}
set(V) {
set name(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -173,22 +143,17 @@ Object.defineProperty(HTMLFormElement.prototype, "name", {
});
this.setAttribute("name", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFormElement.prototype, "noValidate", {
get() {
get noValidate() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this.hasAttribute("noValidate");
},
}
set(V) {
set noValidate(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -202,23 +167,18 @@ Object.defineProperty(HTMLFormElement.prototype, "noValidate", {
} else {
this.removeAttribute("noValidate");
}
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFormElement.prototype, "target", {
get() {
get target() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("target");
return value === null ? "" : value;
},
}
set(V) {
set target(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -228,14 +188,9 @@ Object.defineProperty(HTMLFormElement.prototype, "target", {
});
this.setAttribute("target", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFormElement.prototype, "elements", {
get() {
get elements() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -243,32 +198,32 @@ Object.defineProperty(HTMLFormElement.prototype, "elements", {
return utils.getSameObject(this, "elements", () => {
return utils.tryWrapperForImpl(this[impl]["elements"]);
});
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFormElement.prototype, "length", {
get() {
get length() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["length"];
},
enumerable: true,
configurable: true
}
}
Object.defineProperties(HTMLFormElement.prototype, {
submit: { enumerable: true },
reset: { enumerable: true },
checkValidity: { enumerable: true },
reportValidity: { enumerable: true },
acceptCharset: { enumerable: true },
action: { enumerable: true },
enctype: { enumerable: true },
method: { enumerable: true },
name: { enumerable: true },
noValidate: { enumerable: true },
target: { enumerable: true },
elements: { enumerable: true },
length: { enumerable: true },
[Symbol.toStringTag]: { value: "HTMLFormElement", configurable: true }
});
Object.defineProperty(HTMLFormElement.prototype, Symbol.toStringTag, {
value: "HTMLFormElement",
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
@@ -330,8 +285,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -6,31 +6,21 @@ const utils = require("./utils.js");
const impl = utils.implSymbol;
const HTMLElement = require("./HTMLElement.js");
function HTMLFrameElement() {
throw new TypeError("Illegal constructor");
}
class HTMLFrameElement extends HTMLElement.interface {
constructor() {
throw new TypeError("Illegal constructor");
}
Object.setPrototypeOf(HTMLFrameElement.prototype, HTMLElement.interface.prototype);
Object.setPrototypeOf(HTMLFrameElement, HTMLElement.interface);
Object.defineProperty(HTMLFrameElement, "prototype", {
value: HTMLFrameElement.prototype,
writable: false,
enumerable: false,
configurable: false
});
Object.defineProperty(HTMLFrameElement.prototype, "name", {
get() {
get name() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("name");
return value === null ? "" : value;
},
}
set(V) {
set name(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -40,23 +30,18 @@ Object.defineProperty(HTMLFrameElement.prototype, "name", {
});
this.setAttribute("name", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFrameElement.prototype, "scrolling", {
get() {
get scrolling() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("scrolling");
return value === null ? "" : value;
},
}
set(V) {
set scrolling(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -66,22 +51,17 @@ Object.defineProperty(HTMLFrameElement.prototype, "scrolling", {
});
this.setAttribute("scrolling", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFrameElement.prototype, "src", {
get() {
get src() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["src"];
},
}
set(V) {
set src(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -91,23 +71,18 @@ Object.defineProperty(HTMLFrameElement.prototype, "src", {
});
this[impl]["src"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFrameElement.prototype, "frameBorder", {
get() {
get frameBorder() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("frameBorder");
return value === null ? "" : value;
},
}
set(V) {
set frameBorder(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -117,22 +92,17 @@ Object.defineProperty(HTMLFrameElement.prototype, "frameBorder", {
});
this.setAttribute("frameBorder", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFrameElement.prototype, "longDesc", {
get() {
get longDesc() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["longDesc"];
},
}
set(V) {
set longDesc(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -142,22 +112,17 @@ Object.defineProperty(HTMLFrameElement.prototype, "longDesc", {
});
this[impl]["longDesc"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFrameElement.prototype, "noResize", {
get() {
get noResize() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this.hasAttribute("noResize");
},
}
set(V) {
set noResize(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -171,49 +136,34 @@ Object.defineProperty(HTMLFrameElement.prototype, "noResize", {
} else {
this.removeAttribute("noResize");
}
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFrameElement.prototype, "contentDocument", {
get() {
get contentDocument() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["contentDocument"]);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFrameElement.prototype, "contentWindow", {
get() {
get contentWindow() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["contentWindow"]);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFrameElement.prototype, "marginHeight", {
get() {
get marginHeight() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("marginHeight");
return value === null ? "" : value;
},
}
set(V) {
set marginHeight(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -224,23 +174,18 @@ Object.defineProperty(HTMLFrameElement.prototype, "marginHeight", {
});
this.setAttribute("marginHeight", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFrameElement.prototype, "marginWidth", {
get() {
get marginWidth() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("marginWidth");
return value === null ? "" : value;
},
}
set(V) {
set marginWidth(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -251,19 +196,21 @@ Object.defineProperty(HTMLFrameElement.prototype, "marginWidth", {
});
this.setAttribute("marginWidth", V);
},
enumerable: true,
configurable: true
}
}
Object.defineProperties(HTMLFrameElement.prototype, {
name: { enumerable: true },
scrolling: { enumerable: true },
src: { enumerable: true },
frameBorder: { enumerable: true },
longDesc: { enumerable: true },
noResize: { enumerable: true },
contentDocument: { enumerable: true },
contentWindow: { enumerable: true },
marginHeight: { enumerable: true },
marginWidth: { enumerable: true },
[Symbol.toStringTag]: { value: "HTMLFrameElement", configurable: true }
});
Object.defineProperty(HTMLFrameElement.prototype, Symbol.toStringTag, {
value: "HTMLFrameElement",
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
@@ -325,8 +272,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -7,31 +7,21 @@ const impl = utils.implSymbol;
const HTMLElement = require("./HTMLElement.js");
const WindowEventHandlers = require("./WindowEventHandlers.js");
function HTMLFrameSetElement() {
throw new TypeError("Illegal constructor");
}
class HTMLFrameSetElement extends HTMLElement.interface {
constructor() {
throw new TypeError("Illegal constructor");
}
Object.setPrototypeOf(HTMLFrameSetElement.prototype, HTMLElement.interface.prototype);
Object.setPrototypeOf(HTMLFrameSetElement, HTMLElement.interface);
Object.defineProperty(HTMLFrameSetElement, "prototype", {
value: HTMLFrameSetElement.prototype,
writable: false,
enumerable: false,
configurable: false
});
Object.defineProperty(HTMLFrameSetElement.prototype, "cols", {
get() {
get cols() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("cols");
return value === null ? "" : value;
},
}
set(V) {
set cols(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -41,23 +31,18 @@ Object.defineProperty(HTMLFrameSetElement.prototype, "cols", {
});
this.setAttribute("cols", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFrameSetElement.prototype, "rows", {
get() {
get rows() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("rows");
return value === null ? "" : value;
},
}
set(V) {
set rows(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -67,22 +52,17 @@ Object.defineProperty(HTMLFrameSetElement.prototype, "rows", {
});
this.setAttribute("rows", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFrameSetElement.prototype, "onafterprint", {
get() {
get onafterprint() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["onafterprint"]);
},
}
set(V) {
set onafterprint(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -90,22 +70,17 @@ Object.defineProperty(HTMLFrameSetElement.prototype, "onafterprint", {
V = utils.tryImplForWrapper(V);
this[impl]["onafterprint"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFrameSetElement.prototype, "onbeforeprint", {
get() {
get onbeforeprint() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["onbeforeprint"]);
},
}
set(V) {
set onbeforeprint(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -113,22 +88,17 @@ Object.defineProperty(HTMLFrameSetElement.prototype, "onbeforeprint", {
V = utils.tryImplForWrapper(V);
this[impl]["onbeforeprint"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFrameSetElement.prototype, "onbeforeunload", {
get() {
get onbeforeunload() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["onbeforeunload"]);
},
}
set(V) {
set onbeforeunload(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -136,22 +106,17 @@ Object.defineProperty(HTMLFrameSetElement.prototype, "onbeforeunload", {
V = utils.tryImplForWrapper(V);
this[impl]["onbeforeunload"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFrameSetElement.prototype, "onhashchange", {
get() {
get onhashchange() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["onhashchange"]);
},
}
set(V) {
set onhashchange(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -159,22 +124,17 @@ Object.defineProperty(HTMLFrameSetElement.prototype, "onhashchange", {
V = utils.tryImplForWrapper(V);
this[impl]["onhashchange"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFrameSetElement.prototype, "onlanguagechange", {
get() {
get onlanguagechange() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["onlanguagechange"]);
},
}
set(V) {
set onlanguagechange(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -182,22 +142,17 @@ Object.defineProperty(HTMLFrameSetElement.prototype, "onlanguagechange", {
V = utils.tryImplForWrapper(V);
this[impl]["onlanguagechange"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFrameSetElement.prototype, "onmessage", {
get() {
get onmessage() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["onmessage"]);
},
}
set(V) {
set onmessage(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -205,22 +160,17 @@ Object.defineProperty(HTMLFrameSetElement.prototype, "onmessage", {
V = utils.tryImplForWrapper(V);
this[impl]["onmessage"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFrameSetElement.prototype, "onmessageerror", {
get() {
get onmessageerror() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["onmessageerror"]);
},
}
set(V) {
set onmessageerror(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -228,22 +178,17 @@ Object.defineProperty(HTMLFrameSetElement.prototype, "onmessageerror", {
V = utils.tryImplForWrapper(V);
this[impl]["onmessageerror"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFrameSetElement.prototype, "onoffline", {
get() {
get onoffline() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["onoffline"]);
},
}
set(V) {
set onoffline(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -251,22 +196,17 @@ Object.defineProperty(HTMLFrameSetElement.prototype, "onoffline", {
V = utils.tryImplForWrapper(V);
this[impl]["onoffline"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFrameSetElement.prototype, "ononline", {
get() {
get ononline() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["ononline"]);
},
}
set(V) {
set ononline(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -274,22 +214,17 @@ Object.defineProperty(HTMLFrameSetElement.prototype, "ononline", {
V = utils.tryImplForWrapper(V);
this[impl]["ononline"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFrameSetElement.prototype, "onpagehide", {
get() {
get onpagehide() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["onpagehide"]);
},
}
set(V) {
set onpagehide(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -297,22 +232,17 @@ Object.defineProperty(HTMLFrameSetElement.prototype, "onpagehide", {
V = utils.tryImplForWrapper(V);
this[impl]["onpagehide"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFrameSetElement.prototype, "onpageshow", {
get() {
get onpageshow() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["onpageshow"]);
},
}
set(V) {
set onpageshow(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -320,22 +250,17 @@ Object.defineProperty(HTMLFrameSetElement.prototype, "onpageshow", {
V = utils.tryImplForWrapper(V);
this[impl]["onpageshow"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFrameSetElement.prototype, "onpopstate", {
get() {
get onpopstate() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["onpopstate"]);
},
}
set(V) {
set onpopstate(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -343,22 +268,17 @@ Object.defineProperty(HTMLFrameSetElement.prototype, "onpopstate", {
V = utils.tryImplForWrapper(V);
this[impl]["onpopstate"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFrameSetElement.prototype, "onrejectionhandled", {
get() {
get onrejectionhandled() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["onrejectionhandled"]);
},
}
set(V) {
set onrejectionhandled(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -366,22 +286,17 @@ Object.defineProperty(HTMLFrameSetElement.prototype, "onrejectionhandled", {
V = utils.tryImplForWrapper(V);
this[impl]["onrejectionhandled"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFrameSetElement.prototype, "onstorage", {
get() {
get onstorage() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["onstorage"]);
},
}
set(V) {
set onstorage(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -389,22 +304,17 @@ Object.defineProperty(HTMLFrameSetElement.prototype, "onstorage", {
V = utils.tryImplForWrapper(V);
this[impl]["onstorage"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFrameSetElement.prototype, "onunhandledrejection", {
get() {
get onunhandledrejection() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["onunhandledrejection"]);
},
}
set(V) {
set onunhandledrejection(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -412,22 +322,17 @@ Object.defineProperty(HTMLFrameSetElement.prototype, "onunhandledrejection", {
V = utils.tryImplForWrapper(V);
this[impl]["onunhandledrejection"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFrameSetElement.prototype, "onunload", {
get() {
get onunload() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["onunload"]);
},
}
set(V) {
set onunload(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -435,19 +340,29 @@ Object.defineProperty(HTMLFrameSetElement.prototype, "onunload", {
V = utils.tryImplForWrapper(V);
this[impl]["onunload"] = V;
},
enumerable: true,
configurable: true
}
}
Object.defineProperties(HTMLFrameSetElement.prototype, {
cols: { enumerable: true },
rows: { enumerable: true },
onafterprint: { enumerable: true },
onbeforeprint: { enumerable: true },
onbeforeunload: { enumerable: true },
onhashchange: { enumerable: true },
onlanguagechange: { enumerable: true },
onmessage: { enumerable: true },
onmessageerror: { enumerable: true },
onoffline: { enumerable: true },
ononline: { enumerable: true },
onpagehide: { enumerable: true },
onpageshow: { enumerable: true },
onpopstate: { enumerable: true },
onrejectionhandled: { enumerable: true },
onstorage: { enumerable: true },
onunhandledrejection: { enumerable: true },
onunload: { enumerable: true },
[Symbol.toStringTag]: { value: "HTMLFrameSetElement", configurable: true }
});
Object.defineProperty(HTMLFrameSetElement.prototype, Symbol.toStringTag, {
value: "HTMLFrameSetElement",
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
@@ -509,8 +424,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -6,31 +6,21 @@ const utils = require("./utils.js");
const impl = utils.implSymbol;
const HTMLElement = require("./HTMLElement.js");
function HTMLHRElement() {
throw new TypeError("Illegal constructor");
}
class HTMLHRElement extends HTMLElement.interface {
constructor() {
throw new TypeError("Illegal constructor");
}
Object.setPrototypeOf(HTMLHRElement.prototype, HTMLElement.interface.prototype);
Object.setPrototypeOf(HTMLHRElement, HTMLElement.interface);
Object.defineProperty(HTMLHRElement, "prototype", {
value: HTMLHRElement.prototype,
writable: false,
enumerable: false,
configurable: false
});
Object.defineProperty(HTMLHRElement.prototype, "align", {
get() {
get align() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("align");
return value === null ? "" : value;
},
}
set(V) {
set align(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -40,23 +30,18 @@ Object.defineProperty(HTMLHRElement.prototype, "align", {
});
this.setAttribute("align", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLHRElement.prototype, "color", {
get() {
get color() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("color");
return value === null ? "" : value;
},
}
set(V) {
set color(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -66,22 +51,17 @@ Object.defineProperty(HTMLHRElement.prototype, "color", {
});
this.setAttribute("color", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLHRElement.prototype, "noShade", {
get() {
get noShade() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this.hasAttribute("noShade");
},
}
set(V) {
set noShade(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -95,23 +75,18 @@ Object.defineProperty(HTMLHRElement.prototype, "noShade", {
} else {
this.removeAttribute("noShade");
}
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLHRElement.prototype, "size", {
get() {
get size() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("size");
return value === null ? "" : value;
},
}
set(V) {
set size(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -121,23 +96,18 @@ Object.defineProperty(HTMLHRElement.prototype, "size", {
});
this.setAttribute("size", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLHRElement.prototype, "width", {
get() {
get width() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("width");
return value === null ? "" : value;
},
}
set(V) {
set width(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -147,19 +117,16 @@ Object.defineProperty(HTMLHRElement.prototype, "width", {
});
this.setAttribute("width", V);
},
enumerable: true,
configurable: true
}
}
Object.defineProperties(HTMLHRElement.prototype, {
align: { enumerable: true },
color: { enumerable: true },
noShade: { enumerable: true },
size: { enumerable: true },
width: { enumerable: true },
[Symbol.toStringTag]: { value: "HTMLHRElement", configurable: true }
});
Object.defineProperty(HTMLHRElement.prototype, Symbol.toStringTag, {
value: "HTMLHRElement",
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
@@ -221,8 +188,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -6,27 +6,14 @@ const utils = require("./utils.js");
const impl = utils.implSymbol;
const HTMLElement = require("./HTMLElement.js");
function HTMLHeadElement() {
throw new TypeError("Illegal constructor");
class HTMLHeadElement extends HTMLElement.interface {
constructor() {
throw new TypeError("Illegal constructor");
}
}
Object.setPrototypeOf(HTMLHeadElement.prototype, HTMLElement.interface.prototype);
Object.setPrototypeOf(HTMLHeadElement, HTMLElement.interface);
Object.defineProperty(HTMLHeadElement, "prototype", {
value: HTMLHeadElement.prototype,
writable: false,
enumerable: false,
configurable: false
Object.defineProperties(HTMLHeadElement.prototype, {
[Symbol.toStringTag]: { value: "HTMLHeadElement", configurable: true }
});
Object.defineProperty(HTMLHeadElement.prototype, Symbol.toStringTag, {
value: "HTMLHeadElement",
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
@@ -88,8 +75,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -6,31 +6,21 @@ const utils = require("./utils.js");
const impl = utils.implSymbol;
const HTMLElement = require("./HTMLElement.js");
function HTMLHeadingElement() {
throw new TypeError("Illegal constructor");
}
class HTMLHeadingElement extends HTMLElement.interface {
constructor() {
throw new TypeError("Illegal constructor");
}
Object.setPrototypeOf(HTMLHeadingElement.prototype, HTMLElement.interface.prototype);
Object.setPrototypeOf(HTMLHeadingElement, HTMLElement.interface);
Object.defineProperty(HTMLHeadingElement, "prototype", {
value: HTMLHeadingElement.prototype,
writable: false,
enumerable: false,
configurable: false
});
Object.defineProperty(HTMLHeadingElement.prototype, "align", {
get() {
get align() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("align");
return value === null ? "" : value;
},
}
set(V) {
set align(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -40,19 +30,12 @@ Object.defineProperty(HTMLHeadingElement.prototype, "align", {
});
this.setAttribute("align", V);
},
enumerable: true,
configurable: true
}
}
Object.defineProperties(HTMLHeadingElement.prototype, {
align: { enumerable: true },
[Symbol.toStringTag]: { value: "HTMLHeadingElement", configurable: true }
});
Object.defineProperty(HTMLHeadingElement.prototype, Symbol.toStringTag, {
value: "HTMLHeadingElement",
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
@@ -114,8 +97,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -6,31 +6,21 @@ const utils = require("./utils.js");
const impl = utils.implSymbol;
const HTMLElement = require("./HTMLElement.js");
function HTMLHtmlElement() {
throw new TypeError("Illegal constructor");
}
class HTMLHtmlElement extends HTMLElement.interface {
constructor() {
throw new TypeError("Illegal constructor");
}
Object.setPrototypeOf(HTMLHtmlElement.prototype, HTMLElement.interface.prototype);
Object.setPrototypeOf(HTMLHtmlElement, HTMLElement.interface);
Object.defineProperty(HTMLHtmlElement, "prototype", {
value: HTMLHtmlElement.prototype,
writable: false,
enumerable: false,
configurable: false
});
Object.defineProperty(HTMLHtmlElement.prototype, "version", {
get() {
get version() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("version");
return value === null ? "" : value;
},
}
set(V) {
set version(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -40,19 +30,12 @@ Object.defineProperty(HTMLHtmlElement.prototype, "version", {
});
this.setAttribute("version", V);
},
enumerable: true,
configurable: true
}
}
Object.defineProperties(HTMLHtmlElement.prototype, {
version: { enumerable: true },
[Symbol.toStringTag]: { value: "HTMLHtmlElement", configurable: true }
});
Object.defineProperty(HTMLHtmlElement.prototype, Symbol.toStringTag, {
value: "HTMLHtmlElement",
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
@@ -114,8 +97,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -5,27 +5,20 @@ const utils = require("./utils.js");
const impl = utils.implSymbol;
function HTMLHyperlinkElementUtils() {
throw new TypeError("Illegal constructor");
}
class HTMLHyperlinkElementUtils {
constructor() {
throw new TypeError("Illegal constructor");
}
Object.defineProperty(HTMLHyperlinkElementUtils, "prototype", {
value: HTMLHyperlinkElementUtils.prototype,
writable: false,
enumerable: false,
configurable: false
});
Object.defineProperty(HTMLHyperlinkElementUtils.prototype, "href", {
get() {
get href() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["href"];
},
}
set(V) {
set href(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -35,42 +28,32 @@ Object.defineProperty(HTMLHyperlinkElementUtils.prototype, "href", {
});
this[impl]["href"] = V;
},
enumerable: true,
configurable: true
});
HTMLHyperlinkElementUtils.prototype.toString = function toString() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["href"];
};
Object.defineProperty(HTMLHyperlinkElementUtils.prototype, "origin", {
get() {
toString() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["href"];
}
get origin() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["origin"];
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLHyperlinkElementUtils.prototype, "protocol", {
get() {
get protocol() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["protocol"];
},
}
set(V) {
set protocol(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -80,22 +63,17 @@ Object.defineProperty(HTMLHyperlinkElementUtils.prototype, "protocol", {
});
this[impl]["protocol"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLHyperlinkElementUtils.prototype, "username", {
get() {
get username() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["username"];
},
}
set(V) {
set username(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -105,22 +83,17 @@ Object.defineProperty(HTMLHyperlinkElementUtils.prototype, "username", {
});
this[impl]["username"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLHyperlinkElementUtils.prototype, "password", {
get() {
get password() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["password"];
},
}
set(V) {
set password(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -130,22 +103,17 @@ Object.defineProperty(HTMLHyperlinkElementUtils.prototype, "password", {
});
this[impl]["password"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLHyperlinkElementUtils.prototype, "host", {
get() {
get host() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["host"];
},
}
set(V) {
set host(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -155,22 +123,17 @@ Object.defineProperty(HTMLHyperlinkElementUtils.prototype, "host", {
});
this[impl]["host"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLHyperlinkElementUtils.prototype, "hostname", {
get() {
get hostname() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["hostname"];
},
}
set(V) {
set hostname(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -180,22 +143,17 @@ Object.defineProperty(HTMLHyperlinkElementUtils.prototype, "hostname", {
});
this[impl]["hostname"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLHyperlinkElementUtils.prototype, "port", {
get() {
get port() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["port"];
},
}
set(V) {
set port(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -205,22 +163,17 @@ Object.defineProperty(HTMLHyperlinkElementUtils.prototype, "port", {
});
this[impl]["port"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLHyperlinkElementUtils.prototype, "pathname", {
get() {
get pathname() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["pathname"];
},
}
set(V) {
set pathname(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -230,22 +183,17 @@ Object.defineProperty(HTMLHyperlinkElementUtils.prototype, "pathname", {
});
this[impl]["pathname"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLHyperlinkElementUtils.prototype, "search", {
get() {
get search() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["search"];
},
}
set(V) {
set search(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -255,22 +203,17 @@ Object.defineProperty(HTMLHyperlinkElementUtils.prototype, "search", {
});
this[impl]["search"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLHyperlinkElementUtils.prototype, "hash", {
get() {
get hash() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["hash"];
},
}
set(V) {
set hash(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -280,19 +223,23 @@ Object.defineProperty(HTMLHyperlinkElementUtils.prototype, "hash", {
});
this[impl]["hash"] = V;
},
enumerable: true,
configurable: true
}
}
Object.defineProperties(HTMLHyperlinkElementUtils.prototype, {
href: { enumerable: true },
toString: { enumerable: true },
origin: { enumerable: true },
protocol: { enumerable: true },
username: { enumerable: true },
password: { enumerable: true },
host: { enumerable: true },
hostname: { enumerable: true },
port: { enumerable: true },
pathname: { enumerable: true },
search: { enumerable: true },
hash: { enumerable: true },
[Symbol.toStringTag]: { value: "HTMLHyperlinkElementUtils", configurable: true }
});
Object.defineProperty(HTMLHyperlinkElementUtils.prototype, Symbol.toStringTag, {
value: "HTMLHyperlinkElementUtils",
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
@@ -352,8 +299,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -6,38 +6,28 @@ const utils = require("./utils.js");
const impl = utils.implSymbol;
const HTMLElement = require("./HTMLElement.js");
function HTMLIFrameElement() {
throw new TypeError("Illegal constructor");
}
Object.setPrototypeOf(HTMLIFrameElement.prototype, HTMLElement.interface.prototype);
Object.setPrototypeOf(HTMLIFrameElement, HTMLElement.interface);
Object.defineProperty(HTMLIFrameElement, "prototype", {
value: HTMLIFrameElement.prototype,
writable: false,
enumerable: false,
configurable: false
});
HTMLIFrameElement.prototype.getSVGDocument = function getSVGDocument() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
class HTMLIFrameElement extends HTMLElement.interface {
constructor() {
throw new TypeError("Illegal constructor");
}
return utils.tryWrapperForImpl(this[impl].getSVGDocument());
};
getSVGDocument() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
Object.defineProperty(HTMLIFrameElement.prototype, "src", {
get() {
return utils.tryWrapperForImpl(this[impl].getSVGDocument());
}
get src() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["src"];
},
}
set(V) {
set src(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -47,23 +37,18 @@ Object.defineProperty(HTMLIFrameElement.prototype, "src", {
});
this[impl]["src"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLIFrameElement.prototype, "srcdoc", {
get() {
get srcdoc() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("srcdoc");
return value === null ? "" : value;
},
}
set(V) {
set srcdoc(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -73,23 +58,18 @@ Object.defineProperty(HTMLIFrameElement.prototype, "srcdoc", {
});
this.setAttribute("srcdoc", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLIFrameElement.prototype, "name", {
get() {
get name() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("name");
return value === null ? "" : value;
},
}
set(V) {
set name(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -99,22 +79,17 @@ Object.defineProperty(HTMLIFrameElement.prototype, "name", {
});
this.setAttribute("name", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLIFrameElement.prototype, "allowFullscreen", {
get() {
get allowFullscreen() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this.hasAttribute("allowFullscreen");
},
}
set(V) {
set allowFullscreen(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -128,23 +103,18 @@ Object.defineProperty(HTMLIFrameElement.prototype, "allowFullscreen", {
} else {
this.removeAttribute("allowFullscreen");
}
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLIFrameElement.prototype, "width", {
get() {
get width() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("width");
return value === null ? "" : value;
},
}
set(V) {
set width(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -154,23 +124,18 @@ Object.defineProperty(HTMLIFrameElement.prototype, "width", {
});
this.setAttribute("width", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLIFrameElement.prototype, "height", {
get() {
get height() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("height");
return value === null ? "" : value;
},
}
set(V) {
set height(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -180,49 +145,34 @@ Object.defineProperty(HTMLIFrameElement.prototype, "height", {
});
this.setAttribute("height", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLIFrameElement.prototype, "contentDocument", {
get() {
get contentDocument() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["contentDocument"]);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLIFrameElement.prototype, "contentWindow", {
get() {
get contentWindow() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["contentWindow"]);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLIFrameElement.prototype, "align", {
get() {
get align() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("align");
return value === null ? "" : value;
},
}
set(V) {
set align(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -232,23 +182,18 @@ Object.defineProperty(HTMLIFrameElement.prototype, "align", {
});
this.setAttribute("align", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLIFrameElement.prototype, "scrolling", {
get() {
get scrolling() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("scrolling");
return value === null ? "" : value;
},
}
set(V) {
set scrolling(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -258,23 +203,18 @@ Object.defineProperty(HTMLIFrameElement.prototype, "scrolling", {
});
this.setAttribute("scrolling", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLIFrameElement.prototype, "frameBorder", {
get() {
get frameBorder() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("frameBorder");
return value === null ? "" : value;
},
}
set(V) {
set frameBorder(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -284,22 +224,17 @@ Object.defineProperty(HTMLIFrameElement.prototype, "frameBorder", {
});
this.setAttribute("frameBorder", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLIFrameElement.prototype, "longDesc", {
get() {
get longDesc() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["longDesc"];
},
}
set(V) {
set longDesc(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -309,23 +244,18 @@ Object.defineProperty(HTMLIFrameElement.prototype, "longDesc", {
});
this[impl]["longDesc"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLIFrameElement.prototype, "marginHeight", {
get() {
get marginHeight() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("marginHeight");
return value === null ? "" : value;
},
}
set(V) {
set marginHeight(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -336,23 +266,18 @@ Object.defineProperty(HTMLIFrameElement.prototype, "marginHeight", {
});
this.setAttribute("marginHeight", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLIFrameElement.prototype, "marginWidth", {
get() {
get marginWidth() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("marginWidth");
return value === null ? "" : value;
},
}
set(V) {
set marginWidth(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -363,19 +288,26 @@ Object.defineProperty(HTMLIFrameElement.prototype, "marginWidth", {
});
this.setAttribute("marginWidth", V);
},
enumerable: true,
configurable: true
}
}
Object.defineProperties(HTMLIFrameElement.prototype, {
getSVGDocument: { enumerable: true },
src: { enumerable: true },
srcdoc: { enumerable: true },
name: { enumerable: true },
allowFullscreen: { enumerable: true },
width: { enumerable: true },
height: { enumerable: true },
contentDocument: { enumerable: true },
contentWindow: { enumerable: true },
align: { enumerable: true },
scrolling: { enumerable: true },
frameBorder: { enumerable: true },
longDesc: { enumerable: true },
marginHeight: { enumerable: true },
marginWidth: { enumerable: true },
[Symbol.toStringTag]: { value: "HTMLIFrameElement", configurable: true }
});
Object.defineProperty(HTMLIFrameElement.prototype, Symbol.toStringTag, {
value: "HTMLIFrameElement",
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
@@ -437,8 +369,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -6,31 +6,21 @@ const utils = require("./utils.js");
const impl = utils.implSymbol;
const HTMLElement = require("./HTMLElement.js");
function HTMLImageElement() {
throw new TypeError("Illegal constructor");
}
class HTMLImageElement extends HTMLElement.interface {
constructor() {
throw new TypeError("Illegal constructor");
}
Object.setPrototypeOf(HTMLImageElement.prototype, HTMLElement.interface.prototype);
Object.setPrototypeOf(HTMLImageElement, HTMLElement.interface);
Object.defineProperty(HTMLImageElement, "prototype", {
value: HTMLImageElement.prototype,
writable: false,
enumerable: false,
configurable: false
});
Object.defineProperty(HTMLImageElement.prototype, "alt", {
get() {
get alt() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("alt");
return value === null ? "" : value;
},
}
set(V) {
set alt(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -40,22 +30,17 @@ Object.defineProperty(HTMLImageElement.prototype, "alt", {
});
this.setAttribute("alt", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLImageElement.prototype, "src", {
get() {
get src() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["src"];
},
}
set(V) {
set src(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -65,22 +50,17 @@ Object.defineProperty(HTMLImageElement.prototype, "src", {
});
this[impl]["src"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLImageElement.prototype, "srcset", {
get() {
get srcset() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["srcset"];
},
}
set(V) {
set srcset(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -90,23 +70,18 @@ Object.defineProperty(HTMLImageElement.prototype, "srcset", {
});
this[impl]["srcset"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLImageElement.prototype, "sizes", {
get() {
get sizes() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("sizes");
return value === null ? "" : value;
},
}
set(V) {
set sizes(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -116,23 +91,18 @@ Object.defineProperty(HTMLImageElement.prototype, "sizes", {
});
this.setAttribute("sizes", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLImageElement.prototype, "crossOrigin", {
get() {
get crossOrigin() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("crossOrigin");
return value === null ? "" : value;
},
}
set(V) {
set crossOrigin(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -145,23 +115,18 @@ Object.defineProperty(HTMLImageElement.prototype, "crossOrigin", {
});
}
this.setAttribute("crossOrigin", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLImageElement.prototype, "useMap", {
get() {
get useMap() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("useMap");
return value === null ? "" : value;
},
}
set(V) {
set useMap(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -171,22 +136,17 @@ Object.defineProperty(HTMLImageElement.prototype, "useMap", {
});
this.setAttribute("useMap", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLImageElement.prototype, "isMap", {
get() {
get isMap() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this.hasAttribute("isMap");
},
}
set(V) {
set isMap(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -200,22 +160,17 @@ Object.defineProperty(HTMLImageElement.prototype, "isMap", {
} else {
this.removeAttribute("isMap");
}
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLImageElement.prototype, "width", {
get() {
get width() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["width"];
},
}
set(V) {
set width(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -225,22 +180,17 @@ Object.defineProperty(HTMLImageElement.prototype, "width", {
});
this[impl]["width"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLImageElement.prototype, "height", {
get() {
get height() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["height"];
},
}
set(V) {
set height(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -250,75 +200,50 @@ Object.defineProperty(HTMLImageElement.prototype, "height", {
});
this[impl]["height"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLImageElement.prototype, "naturalWidth", {
get() {
get naturalWidth() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["naturalWidth"];
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLImageElement.prototype, "naturalHeight", {
get() {
get naturalHeight() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["naturalHeight"];
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLImageElement.prototype, "complete", {
get() {
get complete() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["complete"];
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLImageElement.prototype, "currentSrc", {
get() {
get currentSrc() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["currentSrc"];
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLImageElement.prototype, "name", {
get() {
get name() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("name");
return value === null ? "" : value;
},
}
set(V) {
set name(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -328,22 +253,17 @@ Object.defineProperty(HTMLImageElement.prototype, "name", {
});
this.setAttribute("name", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLImageElement.prototype, "lowsrc", {
get() {
get lowsrc() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["lowsrc"];
},
}
set(V) {
set lowsrc(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -353,23 +273,18 @@ Object.defineProperty(HTMLImageElement.prototype, "lowsrc", {
});
this[impl]["lowsrc"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLImageElement.prototype, "align", {
get() {
get align() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("align");
return value === null ? "" : value;
},
}
set(V) {
set align(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -379,23 +294,18 @@ Object.defineProperty(HTMLImageElement.prototype, "align", {
});
this.setAttribute("align", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLImageElement.prototype, "hspace", {
get() {
get hspace() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = parseInt(this.getAttribute("hspace"));
return isNaN(value) || value < 0 || value > 2147483647 ? 0 : value;
},
}
set(V) {
set hspace(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -405,23 +315,18 @@ Object.defineProperty(HTMLImageElement.prototype, "hspace", {
});
this.setAttribute("hspace", String(V > 2147483647 ? 0 : V));
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLImageElement.prototype, "vspace", {
get() {
get vspace() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = parseInt(this.getAttribute("vspace"));
return isNaN(value) || value < 0 || value > 2147483647 ? 0 : value;
},
}
set(V) {
set vspace(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -431,22 +336,17 @@ Object.defineProperty(HTMLImageElement.prototype, "vspace", {
});
this.setAttribute("vspace", String(V > 2147483647 ? 0 : V));
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLImageElement.prototype, "longDesc", {
get() {
get longDesc() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["longDesc"];
},
}
set(V) {
set longDesc(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -456,23 +356,18 @@ Object.defineProperty(HTMLImageElement.prototype, "longDesc", {
});
this[impl]["longDesc"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLImageElement.prototype, "border", {
get() {
get border() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("border");
return value === null ? "" : value;
},
}
set(V) {
set border(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -483,19 +378,31 @@ Object.defineProperty(HTMLImageElement.prototype, "border", {
});
this.setAttribute("border", V);
},
enumerable: true,
configurable: true
}
}
Object.defineProperties(HTMLImageElement.prototype, {
alt: { enumerable: true },
src: { enumerable: true },
srcset: { enumerable: true },
sizes: { enumerable: true },
crossOrigin: { enumerable: true },
useMap: { enumerable: true },
isMap: { enumerable: true },
width: { enumerable: true },
height: { enumerable: true },
naturalWidth: { enumerable: true },
naturalHeight: { enumerable: true },
complete: { enumerable: true },
currentSrc: { enumerable: true },
name: { enumerable: true },
lowsrc: { enumerable: true },
align: { enumerable: true },
hspace: { enumerable: true },
vspace: { enumerable: true },
longDesc: { enumerable: true },
border: { enumerable: true },
[Symbol.toStringTag]: { value: "HTMLImageElement", configurable: true }
});
Object.defineProperty(HTMLImageElement.prototype, Symbol.toStringTag, {
value: "HTMLImageElement",
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
@@ -557,8 +464,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

File diff suppressed because it is too large Load Diff

View File

@@ -6,31 +6,21 @@ const utils = require("./utils.js");
const impl = utils.implSymbol;
const HTMLElement = require("./HTMLElement.js");
function HTMLLIElement() {
throw new TypeError("Illegal constructor");
}
class HTMLLIElement extends HTMLElement.interface {
constructor() {
throw new TypeError("Illegal constructor");
}
Object.setPrototypeOf(HTMLLIElement.prototype, HTMLElement.interface.prototype);
Object.setPrototypeOf(HTMLLIElement, HTMLElement.interface);
Object.defineProperty(HTMLLIElement, "prototype", {
value: HTMLLIElement.prototype,
writable: false,
enumerable: false,
configurable: false
});
Object.defineProperty(HTMLLIElement.prototype, "value", {
get() {
get value() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = parseInt(this.getAttribute("value"));
return isNaN(value) || value < -2147483648 || value > 2147483647 ? 0 : value;
},
}
set(V) {
set value(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -40,23 +30,18 @@ Object.defineProperty(HTMLLIElement.prototype, "value", {
});
this.setAttribute("value", String(V));
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLLIElement.prototype, "type", {
get() {
get type() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("type");
return value === null ? "" : value;
},
}
set(V) {
set type(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -66,19 +51,13 @@ Object.defineProperty(HTMLLIElement.prototype, "type", {
});
this.setAttribute("type", V);
},
enumerable: true,
configurable: true
}
}
Object.defineProperties(HTMLLIElement.prototype, {
value: { enumerable: true },
type: { enumerable: true },
[Symbol.toStringTag]: { value: "HTMLLIElement", configurable: true }
});
Object.defineProperty(HTMLLIElement.prototype, Symbol.toStringTag, {
value: "HTMLLIElement",
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
@@ -140,8 +119,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -6,44 +6,29 @@ const utils = require("./utils.js");
const impl = utils.implSymbol;
const HTMLElement = require("./HTMLElement.js");
function HTMLLabelElement() {
throw new TypeError("Illegal constructor");
}
class HTMLLabelElement extends HTMLElement.interface {
constructor() {
throw new TypeError("Illegal constructor");
}
Object.setPrototypeOf(HTMLLabelElement.prototype, HTMLElement.interface.prototype);
Object.setPrototypeOf(HTMLLabelElement, HTMLElement.interface);
Object.defineProperty(HTMLLabelElement, "prototype", {
value: HTMLLabelElement.prototype,
writable: false,
enumerable: false,
configurable: false
});
Object.defineProperty(HTMLLabelElement.prototype, "form", {
get() {
get form() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["form"]);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLLabelElement.prototype, "htmlFor", {
get() {
get htmlFor() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("for");
return value === null ? "" : value;
},
}
set(V) {
set htmlFor(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -53,19 +38,22 @@ Object.defineProperty(HTMLLabelElement.prototype, "htmlFor", {
});
this.setAttribute("for", V);
},
}
enumerable: true,
configurable: true
get control() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["control"]);
}
}
Object.defineProperties(HTMLLabelElement.prototype, {
form: { enumerable: true },
htmlFor: { enumerable: true },
control: { enumerable: true },
[Symbol.toStringTag]: { value: "HTMLLabelElement", configurable: true }
});
Object.defineProperty(HTMLLabelElement.prototype, Symbol.toStringTag, {
value: "HTMLLabelElement",
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
@@ -127,8 +115,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -6,44 +6,29 @@ const utils = require("./utils.js");
const impl = utils.implSymbol;
const HTMLElement = require("./HTMLElement.js");
function HTMLLegendElement() {
throw new TypeError("Illegal constructor");
}
class HTMLLegendElement extends HTMLElement.interface {
constructor() {
throw new TypeError("Illegal constructor");
}
Object.setPrototypeOf(HTMLLegendElement.prototype, HTMLElement.interface.prototype);
Object.setPrototypeOf(HTMLLegendElement, HTMLElement.interface);
Object.defineProperty(HTMLLegendElement, "prototype", {
value: HTMLLegendElement.prototype,
writable: false,
enumerable: false,
configurable: false
});
Object.defineProperty(HTMLLegendElement.prototype, "form", {
get() {
get form() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["form"]);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLLegendElement.prototype, "align", {
get() {
get align() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("align");
return value === null ? "" : value;
},
}
set(V) {
set align(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -53,19 +38,13 @@ Object.defineProperty(HTMLLegendElement.prototype, "align", {
});
this.setAttribute("align", V);
},
enumerable: true,
configurable: true
}
}
Object.defineProperties(HTMLLegendElement.prototype, {
form: { enumerable: true },
align: { enumerable: true },
[Symbol.toStringTag]: { value: "HTMLLegendElement", configurable: true }
});
Object.defineProperty(HTMLLegendElement.prototype, Symbol.toStringTag, {
value: "HTMLLegendElement",
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
@@ -127,8 +106,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -7,30 +7,20 @@ const impl = utils.implSymbol;
const HTMLElement = require("./HTMLElement.js");
const LinkStyle = require("./LinkStyle.js");
function HTMLLinkElement() {
throw new TypeError("Illegal constructor");
}
class HTMLLinkElement extends HTMLElement.interface {
constructor() {
throw new TypeError("Illegal constructor");
}
Object.setPrototypeOf(HTMLLinkElement.prototype, HTMLElement.interface.prototype);
Object.setPrototypeOf(HTMLLinkElement, HTMLElement.interface);
Object.defineProperty(HTMLLinkElement, "prototype", {
value: HTMLLinkElement.prototype,
writable: false,
enumerable: false,
configurable: false
});
Object.defineProperty(HTMLLinkElement.prototype, "href", {
get() {
get href() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["href"];
},
}
set(V) {
set href(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -40,23 +30,18 @@ Object.defineProperty(HTMLLinkElement.prototype, "href", {
});
this[impl]["href"] = V;
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLLinkElement.prototype, "crossOrigin", {
get() {
get crossOrigin() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("crossOrigin");
return value === null ? "" : value;
},
}
set(V) {
set crossOrigin(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -69,23 +54,18 @@ Object.defineProperty(HTMLLinkElement.prototype, "crossOrigin", {
});
}
this.setAttribute("crossOrigin", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLLinkElement.prototype, "rel", {
get() {
get rel() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("rel");
return value === null ? "" : value;
},
}
set(V) {
set rel(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -95,23 +75,36 @@ Object.defineProperty(HTMLLinkElement.prototype, "rel", {
});
this.setAttribute("rel", V);
},
}
enumerable: true,
configurable: true
});
get relList() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
Object.defineProperty(HTMLLinkElement.prototype, "media", {
get() {
return utils.getSameObject(this, "relList", () => {
return utils.tryWrapperForImpl(this[impl]["relList"]);
});
}
set relList(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
this.relList.value = V;
}
get media() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("media");
return value === null ? "" : value;
},
}
set(V) {
set media(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -121,23 +114,18 @@ Object.defineProperty(HTMLLinkElement.prototype, "media", {
});
this.setAttribute("media", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLLinkElement.prototype, "hreflang", {
get() {
get hreflang() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("hreflang");
return value === null ? "" : value;
},
}
set(V) {
set hreflang(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -147,23 +135,18 @@ Object.defineProperty(HTMLLinkElement.prototype, "hreflang", {
});
this.setAttribute("hreflang", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLLinkElement.prototype, "type", {
get() {
get type() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("type");
return value === null ? "" : value;
},
}
set(V) {
set type(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -173,23 +156,18 @@ Object.defineProperty(HTMLLinkElement.prototype, "type", {
});
this.setAttribute("type", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLLinkElement.prototype, "charset", {
get() {
get charset() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("charset");
return value === null ? "" : value;
},
}
set(V) {
set charset(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -199,23 +177,18 @@ Object.defineProperty(HTMLLinkElement.prototype, "charset", {
});
this.setAttribute("charset", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLLinkElement.prototype, "rev", {
get() {
get rev() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("rev");
return value === null ? "" : value;
},
}
set(V) {
set rev(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -225,23 +198,18 @@ Object.defineProperty(HTMLLinkElement.prototype, "rev", {
});
this.setAttribute("rev", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLLinkElement.prototype, "target", {
get() {
get target() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("target");
return value === null ? "" : value;
},
}
set(V) {
set target(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -251,32 +219,30 @@ Object.defineProperty(HTMLLinkElement.prototype, "target", {
});
this.setAttribute("target", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLLinkElement.prototype, "sheet", {
get() {
get sheet() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["sheet"]);
},
enumerable: true,
configurable: true
}
}
Object.defineProperties(HTMLLinkElement.prototype, {
href: { enumerable: true },
crossOrigin: { enumerable: true },
rel: { enumerable: true },
relList: { enumerable: true },
media: { enumerable: true },
hreflang: { enumerable: true },
type: { enumerable: true },
charset: { enumerable: true },
rev: { enumerable: true },
target: { enumerable: true },
sheet: { enumerable: true },
[Symbol.toStringTag]: { value: "HTMLLinkElement", configurable: true }
});
Object.defineProperty(HTMLLinkElement.prototype, Symbol.toStringTag, {
value: "HTMLLinkElement",
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
@@ -338,8 +304,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -6,31 +6,21 @@ const utils = require("./utils.js");
const impl = utils.implSymbol;
const HTMLElement = require("./HTMLElement.js");
function HTMLMapElement() {
throw new TypeError("Illegal constructor");
}
class HTMLMapElement extends HTMLElement.interface {
constructor() {
throw new TypeError("Illegal constructor");
}
Object.setPrototypeOf(HTMLMapElement.prototype, HTMLElement.interface.prototype);
Object.setPrototypeOf(HTMLMapElement, HTMLElement.interface);
Object.defineProperty(HTMLMapElement, "prototype", {
value: HTMLMapElement.prototype,
writable: false,
enumerable: false,
configurable: false
});
Object.defineProperty(HTMLMapElement.prototype, "name", {
get() {
get name() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("name");
return value === null ? "" : value;
},
}
set(V) {
set name(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -40,14 +30,9 @@ Object.defineProperty(HTMLMapElement.prototype, "name", {
});
this.setAttribute("name", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLMapElement.prototype, "areas", {
get() {
get areas() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -55,19 +40,13 @@ Object.defineProperty(HTMLMapElement.prototype, "areas", {
return utils.getSameObject(this, "areas", () => {
return utils.tryWrapperForImpl(this[impl]["areas"]);
});
},
enumerable: true,
configurable: true
}
}
Object.defineProperties(HTMLMapElement.prototype, {
name: { enumerable: true },
areas: { enumerable: true },
[Symbol.toStringTag]: { value: "HTMLMapElement", configurable: true }
});
Object.defineProperty(HTMLMapElement.prototype, Symbol.toStringTag, {
value: "HTMLMapElement",
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
@@ -129,8 +108,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

View File

@@ -6,31 +6,21 @@ const utils = require("./utils.js");
const impl = utils.implSymbol;
const HTMLElement = require("./HTMLElement.js");
function HTMLMarqueeElement() {
throw new TypeError("Illegal constructor");
}
class HTMLMarqueeElement extends HTMLElement.interface {
constructor() {
throw new TypeError("Illegal constructor");
}
Object.setPrototypeOf(HTMLMarqueeElement.prototype, HTMLElement.interface.prototype);
Object.setPrototypeOf(HTMLMarqueeElement, HTMLElement.interface);
Object.defineProperty(HTMLMarqueeElement, "prototype", {
value: HTMLMarqueeElement.prototype,
writable: false,
enumerable: false,
configurable: false
});
Object.defineProperty(HTMLMarqueeElement.prototype, "behavior", {
get() {
get behavior() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("behavior");
return value === null ? "" : value;
},
}
set(V) {
set behavior(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -40,23 +30,18 @@ Object.defineProperty(HTMLMarqueeElement.prototype, "behavior", {
});
this.setAttribute("behavior", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLMarqueeElement.prototype, "bgColor", {
get() {
get bgColor() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("bgcolor");
return value === null ? "" : value;
},
}
set(V) {
set bgColor(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -66,23 +51,18 @@ Object.defineProperty(HTMLMarqueeElement.prototype, "bgColor", {
});
this.setAttribute("bgcolor", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLMarqueeElement.prototype, "direction", {
get() {
get direction() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("direction");
return value === null ? "" : value;
},
}
set(V) {
set direction(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -92,23 +72,18 @@ Object.defineProperty(HTMLMarqueeElement.prototype, "direction", {
});
this.setAttribute("direction", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLMarqueeElement.prototype, "height", {
get() {
get height() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("height");
return value === null ? "" : value;
},
}
set(V) {
set height(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -118,23 +93,18 @@ Object.defineProperty(HTMLMarqueeElement.prototype, "height", {
});
this.setAttribute("height", V);
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLMarqueeElement.prototype, "hspace", {
get() {
get hspace() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = parseInt(this.getAttribute("hspace"));
return isNaN(value) || value < 0 || value > 2147483647 ? 0 : value;
},
}
set(V) {
set hspace(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -144,23 +114,18 @@ Object.defineProperty(HTMLMarqueeElement.prototype, "hspace", {
});
this.setAttribute("hspace", String(V > 2147483647 ? 0 : V));
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLMarqueeElement.prototype, "scrollAmount", {
get() {
get scrollAmount() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = parseInt(this.getAttribute("scrollamount"));
return isNaN(value) || value < 0 || value > 2147483647 ? 0 : value;
},
}
set(V) {
set scrollAmount(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -170,23 +135,18 @@ Object.defineProperty(HTMLMarqueeElement.prototype, "scrollAmount", {
});
this.setAttribute("scrollamount", String(V > 2147483647 ? 0 : V));
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLMarqueeElement.prototype, "scrollDelay", {
get() {
get scrollDelay() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = parseInt(this.getAttribute("scrolldelay"));
return isNaN(value) || value < 0 || value > 2147483647 ? 0 : value;
},
}
set(V) {
set scrollDelay(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -196,22 +156,17 @@ Object.defineProperty(HTMLMarqueeElement.prototype, "scrollDelay", {
});
this.setAttribute("scrolldelay", String(V > 2147483647 ? 0 : V));
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLMarqueeElement.prototype, "trueSpeed", {
get() {
get trueSpeed() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this.hasAttribute("truespeed");
},
}
set(V) {
set trueSpeed(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -225,23 +180,18 @@ Object.defineProperty(HTMLMarqueeElement.prototype, "trueSpeed", {
} else {
this.removeAttribute("truespeed");
}
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLMarqueeElement.prototype, "vspace", {
get() {
get vspace() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = parseInt(this.getAttribute("vspace"));
return isNaN(value) || value < 0 || value > 2147483647 ? 0 : value;
},
}
set(V) {
set vspace(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -251,23 +201,18 @@ Object.defineProperty(HTMLMarqueeElement.prototype, "vspace", {
});
this.setAttribute("vspace", String(V > 2147483647 ? 0 : V));
},
}
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLMarqueeElement.prototype, "width", {
get() {
get width() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("width");
return value === null ? "" : value;
},
}
set(V) {
set width(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
@@ -277,19 +222,21 @@ Object.defineProperty(HTMLMarqueeElement.prototype, "width", {
});
this.setAttribute("width", V);
},
enumerable: true,
configurable: true
}
}
Object.defineProperties(HTMLMarqueeElement.prototype, {
behavior: { enumerable: true },
bgColor: { enumerable: true },
direction: { enumerable: true },
height: { enumerable: true },
hspace: { enumerable: true },
scrollAmount: { enumerable: true },
scrollDelay: { enumerable: true },
trueSpeed: { enumerable: true },
vspace: { enumerable: true },
width: { enumerable: true },
[Symbol.toStringTag]: { value: "HTMLMarqueeElement", configurable: true }
});
Object.defineProperty(HTMLMarqueeElement.prototype, Symbol.toStringTag, {
value: "HTMLMarqueeElement",
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
@@ -351,8 +298,6 @@ const iface = {
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});

Some files were not shown because too many files have changed in this diff Show More