Removed GopherJS, basic frontend completed, need backend changes for

torrent storage
This commit is contained in:
2017-11-30 18:12:11 -05:00
parent 67fdef16b1
commit e98ad2cc88
69321 changed files with 5498914 additions and 337 deletions

View File

@@ -0,0 +1,461 @@
"use strict";
/* eslint-disable no-unused-expressions */
() => `jsdom 7.x onward only works on Node.js 4 or newer: https://github.com/tmpvar/jsdom#install`;
/* eslint-enable no-unused-expressions */
const fs = require("fs");
const path = require("path");
const CookieJar = require("tough-cookie").CookieJar;
const parseContentType = require("content-type-parser");
const toFileUrl = require("./jsdom/utils").toFileUrl;
const documentFeatures = require("./jsdom/browser/documentfeatures");
const domToHtml = require("./jsdom/browser/domtohtml").domToHtml;
const Window = require("./jsdom/browser/Window");
const resourceLoader = require("./jsdom/browser/resource-loader");
const VirtualConsole = require("./jsdom/virtual-console");
const locationInfo = require("./jsdom/living/helpers/internal-constants").locationInfo;
const idlUtils = require("./jsdom/living/generated/utils");
const Blob = require("./jsdom/living/generated/Blob");
const whatwgURL = require("whatwg-url");
require("./jsdom/living"); // Enable living standard features
/* 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 canReadFilesFromFS = Boolean(fs.readFile); // in a browserify environment, this isn't present
exports.createVirtualConsole = function (options) {
return new VirtualConsole(options);
};
exports.getVirtualConsole = function (window) {
return window._virtualConsole;
};
exports.createCookieJar = function () {
return new CookieJar(null, { looseMode: true });
};
exports.nodeLocation = function (node) {
return idlUtils.implForWrapper(node)[locationInfo];
};
exports.reconfigureWindow = function (window, newProps) {
if ("top" in newProps) {
window._top = newProps.top;
}
};
exports.changeURL = function (window, urlString) {
const doc = idlUtils.implForWrapper(window._document);
const url = whatwgURL.parseURL(urlString);
if (url === "failure") {
throw new TypeError(`Could not parse "${urlString}" as a URL`);
}
doc._URL = url;
doc._origin = whatwgURL.serializeURLToUnicodeOrigin(doc._URL);
};
// Proxy to features module
Object.defineProperty(exports, "defaultDocumentFeatures", {
enumerable: true,
configurable: true,
get() {
return documentFeatures.defaultDocumentFeatures;
},
set(v) {
documentFeatures.defaultDocumentFeatures = v;
}
});
exports.jsdom = function (html, options) {
if (options === undefined) {
options = {};
}
if (options.parsingMode === undefined || options.parsingMode === "auto") {
options.parsingMode = "html";
}
if (options.parsingMode !== "html" && options.parsingMode !== "xml") {
throw new RangeError(`Invalid parsingMode option ${JSON.stringify(options.parsingMode)}; must be either "html", ` +
`"xml", "auto", or undefined`);
}
options.encoding = options.encoding || "UTF-8";
setGlobalDefaultConfig(options);
// Back-compat hack: we have previously suggested nesting these under document, for jsdom.env at least.
// So we need to support that.
if (options.document) {
if (options.document.cookie !== undefined) {
options.cookie = options.document.cookie;
}
if (options.document.referrer !== undefined) {
options.referrer = options.document.referrer;
}
}
// List options explicitly to be clear which are passed through
const window = new Window({
parsingMode: options.parsingMode,
contentType: options.contentType,
encoding: options.encoding,
parser: options.parser,
url: options.url,
lastModified: options.lastModified,
referrer: options.referrer,
cookieJar: options.cookieJar,
cookie: options.cookie,
resourceLoader: options.resourceLoader,
deferClose: options.deferClose,
concurrentNodeIterators: options.concurrentNodeIterators,
virtualConsole: options.virtualConsole,
pool: options.pool,
agent: options.agent,
agentClass: options.agentClass,
agentOptions: options.agentOptions,
strictSSL: options.strictSSL,
proxy: options.proxy,
userAgent: options.userAgent
});
const documentImpl = idlUtils.implForWrapper(window.document);
documentFeatures.applyDocumentFeatures(documentImpl, options.features);
if (options.created) {
options.created(null, window.document.defaultView);
}
if (options.parsingMode === "html") {
if (html === undefined || html === "") {
html = "<html><head></head><body></body></html>";
}
window.document.write(html);
} else if (options.parsingMode === "xml") {
if (html !== undefined) {
documentImpl._htmlToDom.appendHtmlToDocument(html, documentImpl);
}
}
if (window.document.close && !options.deferClose) {
window.document.close();
}
return window.document;
};
exports.jQueryify = exports.jsdom.jQueryify = function (window, jqueryUrl, callback) {
if (!window || !window.document) {
return;
}
const implImpl = idlUtils.implForWrapper(window.document.implementation);
const features = implImpl._features;
implImpl._addFeature("FetchExternalResources", ["script"]);
implImpl._addFeature("ProcessExternalResources", ["script"]);
const scriptEl = window.document.createElement("script");
scriptEl.className = "jsdom";
scriptEl.src = jqueryUrl;
scriptEl.onload = scriptEl.onerror = () => {
implImpl._features = features;
if (callback) {
callback(window, window.jQuery);
}
};
window.document.body.appendChild(scriptEl);
};
exports.env = exports.jsdom.env = function () {
const config = getConfigFromArguments(arguments);
let req = null;
if (config.file && canReadFilesFromFS) {
req = resourceLoader.readFile(config.file,
{ defaultEncoding: config.defaultEncoding, detectMetaCharset: true },
(err, text, res) => {
if (err) {
reportInitError(err, config);
return;
}
const contentType = parseContentType(res.headers["content-type"]);
config.encoding = contentType.get("charset");
setParsingModeFromExtension(config, config.file);
config.html = text;
processHTML(config);
});
} else if (config.html !== undefined) {
processHTML(config);
} else if (config.url) {
req = handleUrl(config);
} else if (config.somethingToAutodetect !== undefined) {
const url = URL.parse(config.somethingToAutodetect);
if (url.protocol && url.hostname) {
config.url = config.somethingToAutodetect;
req = handleUrl(config.somethingToAutodetect);
} else if (canReadFilesFromFS) {
req = resourceLoader.readFile(config.somethingToAutodetect,
{ defaultEncoding: config.defaultEncoding, detectMetaCharset: true },
(err, text, res) => {
if (err) {
if (err.code === "ENOENT" || err.code === "ENAMETOOLONG") {
config.html = config.somethingToAutodetect;
processHTML(config);
} else {
reportInitError(err, config);
}
} else {
const contentType = parseContentType(res.headers["content-type"]);
config.encoding = contentType.get("charset");
setParsingModeFromExtension(config, config.somethingToAutodetect);
config.html = text;
config.url = toFileUrl(config.somethingToAutodetect);
processHTML(config);
}
});
} else {
config.html = config.somethingToAutodetect;
processHTML(config);
}
}
function handleUrl() {
config.cookieJar = config.cookieJar || exports.createCookieJar();
const options = {
defaultEncoding: config.defaultEncoding,
detectMetaCharset: true,
headers: config.headers,
pool: config.pool,
strictSSL: config.strictSSL,
proxy: config.proxy,
cookieJar: config.cookieJar,
userAgent: config.userAgent,
agent: config.agent,
agentClass: config.agentClass,
agentOptions: config.agentOptions
};
const fragment = whatwgURL.parseURL(config.url).fragment;
return resourceLoader.download(config.url, options, (err, responseText, res) => {
if (err) {
reportInitError(err, config);
return;
}
// The use of `res.request.uri.href` ensures that `window.location.href`
// is updated when `request` follows redirects.
config.html = responseText;
config.url = res.request.uri.href;
if (fragment) {
config.url += `#${fragment}`;
}
if (res.headers["last-modified"]) {
config.lastModified = new Date(res.headers["last-modified"]);
}
const contentType = parseContentType(res.headers["content-type"]);
if (config.parsingMode === "auto") {
if (contentType.isXML()) {
config.parsingMode = "xml";
}
}
config.encoding = contentType.get("charset");
processHTML(config);
});
}
return req;
};
exports.serializeDocument = function (doc) {
return domToHtml([doc]);
};
exports.blobToBuffer = function (blob) {
return Blob.is(blob) && idlUtils.implForWrapper(blob)._buffer || undefined;
};
exports.evalVMScript = (window, script) => {
return script.runInContext(idlUtils.implForWrapper(window._document)._global);
};
function processHTML(config) {
const window = exports.jsdom(config.html, config).defaultView;
const implImpl = idlUtils.implForWrapper(window.document.implementation);
const features = JSON.parse(JSON.stringify(implImpl._features));
let docsLoaded = 0;
const totalDocs = config.scripts.length + config.src.length;
if (!window || !window.document) {
reportInitError(new Error("JSDOM: a window object could not be created."), config);
return;
}
function scriptComplete() {
docsLoaded++;
if (docsLoaded >= totalDocs) {
implImpl._features = features;
process.nextTick(() => {
if (config.onload) {
config.onload(window);
}
if (config.done) {
config.done(null, window);
}
});
}
}
function handleScriptError() {
// nextTick so that an exception within scriptComplete won't cause
// another script onerror (which would be an infinite loop)
process.nextTick(scriptComplete);
}
if (config.scripts.length > 0 || config.src.length > 0) {
implImpl._addFeature("FetchExternalResources", ["script"]);
implImpl._addFeature("ProcessExternalResources", ["script"]);
for (const scriptSrc of config.scripts) {
const script = window.document.createElement("script");
script.className = "jsdom";
script.onload = scriptComplete;
script.onerror = handleScriptError;
script.src = scriptSrc;
window.document.body.appendChild(script);
}
for (const scriptText of config.src) {
const script = window.document.createElement("script");
script.onload = scriptComplete;
script.onerror = handleScriptError;
script.text = scriptText;
window.document.documentElement.appendChild(script);
window.document.documentElement.removeChild(script);
}
} else if (window.document.readyState === "complete") {
scriptComplete();
} else {
window.addEventListener("load", scriptComplete);
}
}
function setGlobalDefaultConfig(config) {
config.pool = config.pool !== undefined ? config.pool : {
maxSockets: 6
};
config.agentOptions = config.agentOptions !== undefined ? config.agentOptions : {
keepAlive: true,
keepAliveMsecs: 115 * 1000
};
config.strictSSL = config.strictSSL !== undefined ? config.strictSSL : true;
config.userAgent = config.userAgent ||
`Node.js (${process.platform}; U; rv:${process.version}) AppleWebKit/537.36 (KHTML, like Gecko)`;
}
function getConfigFromArguments(args) {
const config = {};
if (typeof args[0] === "object") {
Object.assign(config, args[0]);
} else {
for (const arg of args) {
switch (typeof arg) {
case "string":
config.somethingToAutodetect = arg;
break;
case "function":
config.done = arg;
break;
case "object":
if (Array.isArray(arg)) {
config.scripts = arg;
} else {
Object.assign(config, arg);
}
break;
}
}
}
if (!config.done && !config.created && !config.onload) {
throw new Error("Must pass a \"created\", \"onload\", or \"done\" option, or a callback, to jsdom.env");
}
if (config.somethingToAutodetect === undefined &&
config.html === undefined && !config.file && !config.url) {
throw new Error("Must pass a \"html\", \"file\", or \"url\" option, or a string, to jsdom.env");
}
config.scripts = ensureArray(config.scripts);
config.src = ensureArray(config.src);
config.parsingMode = config.parsingMode || "auto";
config.features = config.features || {
FetchExternalResources: false,
ProcessExternalResources: false,
SkipExternalResources: false
};
if (!config.url && config.file) {
config.url = toFileUrl(config.file);
}
config.defaultEncoding = config.defaultEncoding || "windows-1252";
setGlobalDefaultConfig(config);
return config;
}
function reportInitError(err, config) {
if (config.created) {
config.created(err);
}
if (config.done) {
config.done(err);
}
}
function ensureArray(value) {
let array = value || [];
if (typeof array === "string") {
array = [array];
}
return array;
}
function setParsingModeFromExtension(config, filename) {
if (config.parsingMode === "auto") {
const ext = path.extname(filename);
if (ext === ".xhtml" || ext === ".xml") {
config.parsingMode = "xml";
}
}
}

View File

@@ -0,0 +1,550 @@
"use strict";
const webIDLConversions = require("webidl-conversions");
const CSSStyleDeclaration = require("cssstyle").CSSStyleDeclaration;
const notImplemented = require("./not-implemented");
const VirtualConsole = require("../virtual-console");
const define = require("../utils").define;
const EventTarget = require("../living/generated/EventTarget");
const namedPropertiesWindow = require("../living/named-properties-window");
const cssom = require("cssom");
const postMessage = require("../living/post-message");
const DOMException = require("../web-idl/DOMException");
const btoa = require("abab").btoa;
const atob = require("abab").atob;
const idlUtils = require("../living/generated/utils");
const createXMLHttpRequest = require("../living/xmlhttprequest");
const createFileReader = require("../living/generated/FileReader").createInterface;
const Document = require("../living/generated/Document");
const Navigator = require("../living/generated/Navigator");
const reportException = require("../living/helpers/runtime-script-errors");
// NB: the require() must be after assigning `module.exports` because this require() is circular
// TODO: this above note might not even be true anymore... figure out the cycle and document it, or clean up.
module.exports = Window;
const dom = require("../living");
const cssSelectorSplitRE = /((?:[^,"']|"[^"]*"|'[^']*')+)/;
const defaultStyleSheet = cssom.parse(require("./default-stylesheet"));
dom.Window = Window;
// NOTE: per https://heycam.github.io/webidl/#Global, all properties on the Window object must be own-properties.
// That is why we assign everything inside of the constructor, instead of using a shared prototype.
// You can verify this in e.g. Firefox or Internet Explorer, which do a good job with Web IDL compliance.
function Window(options) {
EventTarget.setup(this);
const window = this;
///// INTERFACES FROM THE DOM
// TODO: consider a mode of some sort where these are not shared between all DOM instances
// It'd be very memory-expensive in most cases, though.
for (const name in dom) {
Object.defineProperty(window, name, {
enumerable: false,
configurable: true,
writable: true,
value: dom[name]
});
}
this._core = dom;
///// PRIVATE DATA PROPERTIES
// vm initialization is defered until script processing is activated (in level1/core)
this._globalProxy = this;
this.__timers = Object.create(null);
// Set up the window as if it's a top level window.
// If it's not, then references will be corrected by frame/iframe code.
this._parent = this._top = this._globalProxy;
this._frameElement = null;
// List options explicitly to be clear which are passed through
this._document = Document.create([], {
core: dom,
options: {
parsingMode: options.parsingMode,
contentType: options.contentType,
encoding: options.encoding,
cookieJar: options.cookieJar,
parser: options.parser,
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,
defaultView: this._globalProxy,
global: this
}
});
// https://html.spec.whatwg.org/#session-history
this._sessionHistory = [{
document: idlUtils.implForWrapper(this._document),
url: idlUtils.implForWrapper(this._document)._URL,
stateObject: null
}];
this._currentSessionHistoryEntryIndex = 0;
// This implements window.frames.length, since window.frames returns a
// self reference to the window object. This value is incremented in the
// HTMLFrameElement init function (see: level2/html.js).
this._length = 0;
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();
}
///// GETTERS
const navigator = Navigator.create([], { userAgent: options.userAgent });
define(this, {
get length() {
return window._length;
},
get window() {
return window._globalProxy;
},
get frameElement() {
return window._frameElement;
},
get frames() {
return window._globalProxy;
},
get self() {
return window._globalProxy;
},
get parent() {
return window._parent;
},
get top() {
return window._top;
},
get document() {
return window._document;
},
get location() {
return idlUtils.wrapperForImpl(idlUtils.implForWrapper(window._document)._location);
},
get history() {
return idlUtils.wrapperForImpl(idlUtils.implForWrapper(window._document)._history);
},
get navigator() {
return navigator;
}
});
namedPropertiesWindow.initializeWindow(this, dom.HTMLCollection);
///// METHODS for [ImplicitThis] hack
// See https://lists.w3.org/Archives/Public/public-script-coord/2015JanMar/0109.html
this.addEventListener = this.addEventListener.bind(this);
this.removeEventListener = this.removeEventListener.bind(this);
this.dispatchEvent = this.dispatchEvent.bind(this);
///// METHODS
let latestTimerId = 0;
this.setTimeout = function (fn, ms) {
const args = [];
for (let i = 2; i < arguments.length; ++i) {
args[i - 2] = arguments[i];
}
return startTimer(window, setTimeout, clearTimeout, ++latestTimerId, fn, ms, args);
};
this.setInterval = function (fn, ms) {
const args = [];
for (let i = 2; i < arguments.length; ++i) {
args[i - 2] = arguments[i];
}
return startTimer(window, setInterval, clearInterval, ++latestTimerId, fn, ms, args);
};
this.clearInterval = stopTimer.bind(this, window);
this.clearTimeout = stopTimer.bind(this, window);
this.__stopAllTimers = stopAllTimers.bind(this, window);
function Option(text, value, defaultSelected, selected) {
if (text === undefined) {
text = "";
}
text = webIDLConversions.DOMString(text);
if (value !== undefined) {
value = webIDLConversions.DOMString(value);
}
defaultSelected = webIDLConversions.boolean(defaultSelected);
selected = webIDLConversions.boolean(selected);
const option = window._document.createElement("option");
const impl = idlUtils.implForWrapper(option);
if (text !== "") {
impl.text = text;
}
if (value !== undefined) {
impl.setAttribute("value", value);
}
if (defaultSelected) {
impl.setAttribute("selected", "");
}
impl._selectedness = selected;
return option;
}
Object.defineProperty(Option, "prototype", {
value: this.HTMLOptionElement.prototype,
configurable: false,
enumerable: false,
writable: false
});
Object.defineProperty(window, "Option", {
value: Option,
configurable: true,
enumerable: false,
writable: true
});
function Image() {
const img = window._document.createElement("img");
const impl = idlUtils.implForWrapper(img);
if (arguments.length > 0) {
impl.setAttribute("width", String(arguments[0]));
}
if (arguments.length > 1) {
impl.setAttribute("height", String(arguments[1]));
}
return img;
}
Object.defineProperty(Image, "prototype", {
value: this.HTMLImageElement.prototype,
configurable: false,
enumerable: false,
writable: false
});
Object.defineProperty(window, "Image", {
value: Image,
configurable: true,
enumerable: false,
writable: true
});
function Audio(src) {
const audio = window._document.createElement("audio");
const impl = idlUtils.implForWrapper(audio);
impl.setAttribute("preload", "auto");
if (src !== undefined) {
impl.setAttribute("src", String(src));
}
return audio;
}
Object.defineProperty(Audio, "prototype", {
value: this.HTMLAudioElement.prototype,
configurable: false,
enumerable: false,
writable: false
});
Object.defineProperty(window, "Audio", {
value: Audio,
configurable: true,
enumerable: false,
writable: true
});
function wrapConsoleMethod(method) {
return function () {
const args = Array.prototype.slice.call(arguments);
window._virtualConsole.emit.apply(window._virtualConsole, [method].concat(args));
};
}
this.postMessage = postMessage;
this.atob = function (str) {
const result = atob(str);
if (result === null) {
throw new DOMException(DOMException.INVALID_CHARACTER_ERR,
"The string to be decoded contains invalid characters.");
}
return result;
};
this.btoa = function (str) {
const result = btoa(str);
if (result === null) {
throw new DOMException(DOMException.INVALID_CHARACTER_ERR,
"The string to be encoded contains invalid characters.");
}
return result;
};
this.FileReader = createFileReader({
window: this
}).interface;
this.XMLHttpRequest = createXMLHttpRequest(this);
// TODO: necessary for Blob and FileReader due to different-globals weirdness; investigate how to avoid this.
this.ArrayBuffer = ArrayBuffer;
this.Int8Array = Int8Array;
this.Uint8Array = Uint8Array;
this.Uint8ClampedArray = Uint8ClampedArray;
this.Int16Array = Int16Array;
this.Uint16Array = Uint16Array;
this.Int32Array = Int32Array;
this.Uint32Array = Uint32Array;
this.Float32Array = Float32Array;
this.Float64Array = Float64Array;
this.stop = function () {
const manager = idlUtils.implForWrapper(this._document)._requestManager;
if (manager) {
manager.close();
}
};
this.close = function () {
// Recursively close child frame windows, then ourselves.
const currentWindow = this;
(function windowCleaner(windowToClean) {
for (let i = 0; i < windowToClean.length; i++) {
windowCleaner(windowToClean[i]);
}
// We"re already in our own window.close().
if (windowToClean !== currentWindow) {
windowToClean.close();
}
}(this));
// Clear out all listeners. Any in-flight or upcoming events should not get delivered.
idlUtils.implForWrapper(this)._eventListeners = Object.create(null);
if (this._document) {
if (this._document.body) {
this._document.body.innerHTML = "";
}
if (this._document.close) {
// It's especially important to clear out the listeners here because document.close() causes a "load" event to
// fire.
idlUtils.implForWrapper(this._document)._eventListeners = Object.create(null);
this._document.close();
}
const doc = idlUtils.implForWrapper(this._document);
if (doc._requestManager) {
doc._requestManager.close();
}
delete this._document;
}
stopAllTimers(currentWindow);
};
this.getComputedStyle = function (node) {
const s = node.style;
const cs = new CSSStyleDeclaration();
const forEach = Array.prototype.forEach;
function setPropertiesFromRule(rule) {
if (!rule.selectorText) {
return;
}
const selectors = rule.selectorText.split(cssSelectorSplitRE);
let matched = false;
for (const selectorText of selectors) {
if (selectorText !== "" && selectorText !== "," && !matched && matchesDontThrow(node, selectorText)) {
matched = true;
forEach.call(rule.style, property => {
cs.setProperty(property, rule.style.getPropertyValue(property), rule.style.getPropertyPriority(property));
});
}
}
}
function readStylesFromStyleSheet(sheet) {
forEach.call(sheet.cssRules, rule => {
if (rule.media) {
if (Array.prototype.indexOf.call(rule.media, "screen") !== -1) {
forEach.call(rule.cssRules, setPropertiesFromRule);
}
} else {
setPropertiesFromRule(rule);
}
});
}
readStylesFromStyleSheet(defaultStyleSheet);
forEach.call(node.ownerDocument.styleSheets, readStylesFromStyleSheet);
forEach.call(s, property => {
cs.setProperty(property, s.getPropertyValue(property), s.getPropertyPriority(property));
});
return cs;
};
///// PUBLIC DATA PROPERTIES (TODO: should be getters)
this.console = {
assert: wrapConsoleMethod("assert"),
clear: wrapConsoleMethod("clear"),
count: wrapConsoleMethod("count"),
debug: wrapConsoleMethod("debug"),
error: wrapConsoleMethod("error"),
group: wrapConsoleMethod("group"),
groupCollapsed: wrapConsoleMethod("groupCollapsed"),
groupEnd: wrapConsoleMethod("groupEnd"),
info: wrapConsoleMethod("info"),
log: wrapConsoleMethod("log"),
table: wrapConsoleMethod("table"),
time: wrapConsoleMethod("time"),
timeEnd: wrapConsoleMethod("timeEnd"),
trace: wrapConsoleMethod("trace"),
warn: wrapConsoleMethod("warn")
};
function notImplementedMethod(name) {
return function () {
notImplemented(name, window);
};
}
define(this, {
name: "nodejs",
innerWidth: 1024,
innerHeight: 768,
outerWidth: 1024,
outerHeight: 768,
pageXOffset: 0,
pageYOffset: 0,
screenX: 0,
screenY: 0,
screenLeft: 0,
screenTop: 0,
scrollX: 0,
scrollY: 0,
scrollTop: 0,
scrollLeft: 0,
screen: {
width: 0,
height: 0
},
alert: notImplementedMethod("window.alert"),
blur: notImplementedMethod("window.blur"),
confirm: notImplementedMethod("window.confirm"),
createPopup: notImplementedMethod("window.createPopup"),
focus: notImplementedMethod("window.focus"),
moveBy: notImplementedMethod("window.moveBy"),
moveTo: notImplementedMethod("window.moveTo"),
open: notImplementedMethod("window.open"),
print: notImplementedMethod("window.print"),
prompt: notImplementedMethod("window.prompt"),
resizeBy: notImplementedMethod("window.resizeBy"),
resizeTo: notImplementedMethod("window.resizeTo"),
scroll: notImplementedMethod("window.scroll"),
scrollBy: notImplementedMethod("window.scrollBy"),
scrollTo: notImplementedMethod("window.scrollTo"),
toString: () => {
return "[object Window]";
}
});
///// INITIALIZATION
process.nextTick(() => {
if (!window.document) {
return; // window might've been closed already
}
if (window.document.readyState === "complete") {
const ev = window.document.createEvent("HTMLEvents");
ev.initEvent("load", false, false);
window.dispatchEvent(ev);
} else {
window.document.addEventListener("load", () => {
const ev = window.document.createEvent("HTMLEvents");
ev.initEvent("load", false, false);
window.dispatchEvent(ev);
});
}
});
}
Object.setPrototypeOf(Window, EventTarget.interface);
Object.setPrototypeOf(Window.prototype, EventTarget.interface.prototype);
function matchesDontThrow(el, selector) {
try {
return el.matches(selector);
} catch (e) {
return false;
}
}
function startTimer(window, startFn, stopFn, timerId, callback, ms, args) {
if (typeof callback !== "function") {
const code = String(callback);
callback = window._globalProxy.eval.bind(window, code + `\n//# sourceURL=${window.location.href}`);
}
const oldCallback = callback;
callback = () => {
try {
oldCallback.apply(window._globalProxy, args);
} catch (e) {
reportException(window, e, window.location.href);
}
};
const res = startFn(callback, ms);
window.__timers[timerId] = [res, stopFn];
return timerId;
}
function stopTimer(window, id) {
const timer = window.__timers[id];
if (timer) {
// Need to .call() with undefined to ensure the thisArg is not timer itself
timer[1].call(undefined, timer[0]);
delete window.__timers[id];
}
}
function stopAllTimers(window) {
Object.keys(window.__timers).forEach(key => {
const timer = window.__timers[key];
// Need to .call() with undefined to ensure the thisArg is not timer itself
timer[1].call(undefined, timer[0]);
});
window.__timers = Object.create(null);
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,73 @@
"use strict";
const idlUtils = require("../living/generated/utils");
// Tree traversing
exports.getFirstChild = function (node) {
return node.childNodes[0];
};
exports.getChildNodes = function (node) {
// parse5 treats template elements specially, assuming you return an array whose single item is the document fragment
const children = node._templateContents ? [node._templateContents] : [];
if (children.length === 0) {
for (let i = 0; i < node.childNodes.length; ++i) {
children.push(idlUtils.implForWrapper(node.childNodes[i]));
}
}
return children;
};
exports.getParentNode = function (node) {
return node.parentNode;
};
exports.getAttrList = function (node) {
return node.attributes;
};
// Node data
exports.getTagName = function (element) {
return element.tagName.toLowerCase();
};
exports.getNamespaceURI = function (element) {
return element.namespaceURI || "http://www.w3.org/1999/xhtml";
};
exports.getTextNodeContent = function (textNode) {
return textNode.nodeValue;
};
exports.getCommentNodeContent = function (commentNode) {
return commentNode.nodeValue;
};
exports.getDocumentTypeNodeName = function (doctypeNode) {
return doctypeNode.name;
};
exports.getDocumentTypeNodePublicId = function (doctypeNode) {
return doctypeNode.publicId || null;
};
exports.getDocumentTypeNodeSystemId = function (doctypeNode) {
return doctypeNode.systemId || null;
};
// Node types
exports.isTextNode = function (node) {
return node.nodeName === "#text";
};
exports.isCommentNode = function (node) {
return node.nodeName === "#comment";
};
exports.isDocumentTypeNode = function (node) {
return node.nodeType === 10;
};
exports.isElementNode = function (node) {
return Boolean(node.tagName);
};

View File

@@ -0,0 +1,47 @@
"use strict";
exports.availableDocumentFeatures = [
"FetchExternalResources",
"ProcessExternalResources",
"SkipExternalResources"
];
exports.defaultDocumentFeatures = {
FetchExternalResources: ["script", "link"], // omitted by default: "frame"
ProcessExternalResources: ["script"], // omitted by default: "frame", "iframe"
SkipExternalResources: false
};
exports.applyDocumentFeatures = (documentImpl, features) => {
features = 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);
}
}
}
};

View File

@@ -0,0 +1,19 @@
"use strict";
const parse5 = require("parse5");
const documentAdapter = require("./documentAdapter");
const NODE_TYPE = require("../living/node-type");
const idlUtils = require("../living/generated/utils");
const serializer = new parse5.TreeSerializer(documentAdapter);
exports.domToHtml = function (iterable) {
let ret = "";
for (const node of iterable) {
if (node.nodeType === NODE_TYPE.DOCUMENT_NODE) {
ret += serializer.serialize(node);
} else {
ret += serializer.serialize({ childNodes: [idlUtils.wrapperForImpl(node)] });
}
}
return ret;
};

View File

@@ -0,0 +1,323 @@
"use strict";
const parse5 = require("parse5");
const sax = require("sax");
const attributes = require("../living/attributes");
const DocumentType = require("../living/generated/DocumentType");
const locationInfo = require("../living/helpers/internal-constants").locationInfo;
class HtmlToDom {
constructor(core, parser, parsingMode) {
if (!parser) {
if (parsingMode === "xml") {
parser = sax;
} else {
parser = parse5;
}
}
this.core = core;
this.parser = parser;
this.parsingMode = parsingMode;
if (parser.DefaultHandler) {
this.parserType = "htmlparser2";
} else if (parser.Parser && parser.TreeAdapters) {
this.parserType = "parse5v1";
} else if (parser.moduleName === "HTML5") {
this.parserType = "html5";
} else if (parser.parser) {
this.parserType = "sax";
}
}
appendHtmlToElement(html, element) {
if (typeof html !== "string") {
html = String(html);
}
return this["_parseWith" + this.parserType](html, true, element);
}
appendHtmlToDocument(html, element) {
if (typeof html !== "string") {
html = String(html);
}
return this["_parseWith" + this.parserType](html, false, element);
}
_parseWithhtmlparser2(html, fragment, element) {
const handler = new this.parser.DefaultHandler();
// Check if document is XML
const isXML = this.parsingMode === "xml";
const parserInstance = new this.parser.Parser(handler, {
xmlMode: isXML,
lowerCaseTags: !isXML,
lowerCaseAttributeNames: !isXML,
decodeEntities: true
});
parserInstance.includeLocation = false;
parserInstance.parseComplete(html);
const parsed = handler.dom;
for (let i = 0; i < parsed.length; i++) {
setChild(this.core, element, parsed[i]);
}
return element;
}
_parseWithparse5v1(html, fragment, element) {
if (this.parsingMode === "xml") {
throw new Error("Can't parse XML with parse5, please use htmlparser2 instead.");
}
const htmlparser2Adapter = this.parser.TreeAdapters.htmlparser2;
let dom;
if (fragment) {
const instance = new this.parser.Parser(htmlparser2Adapter);
const parentElement = htmlparser2Adapter.createElement(element.tagName.toLowerCase(), element.namespaceURI, []);
dom = instance.parseFragment(html, parentElement);
} else {
const instance = new this.parser.Parser(htmlparser2Adapter, { locationInfo: true });
dom = instance.parse(html);
}
const parsed = dom.children;
for (let i = 0; i < parsed.length; i++) {
setChild(this.core, element, parsed[i]);
}
return element;
}
_parseWithhtml5(html, fragment, element) {
if (element.nodeType === 9) {
new this.parser.Parser({ document: element }).parse(html);
} else {
const p = new this.parser.Parser({ document: element.ownerDocument });
p.parse_fragment(html, element);
}
}
_parseWithsax(html, fragment, element) {
const SaxParser = this.parser.parser;
const parser = new SaxParser(/* strict = */true, { xmlns: true });
parser.noscript = false;
parser.looseCase = "toString";
const openStack = [element];
parser.ontext = text => {
setChild(this.core, openStack[openStack.length - 1], {
type: "text",
data: text
});
};
parser.onopentag = arg => {
const attrValues = {};
const attrPrefixes = {};
const attrNamespaces = {};
Object.keys(arg.attributes).forEach(key => {
const localName = arg.attributes[key].local;
attrValues[localName] = arg.attributes[key].value;
attrPrefixes[localName] = arg.attributes[key].prefix || null;
attrNamespaces[localName] = arg.attributes[key].uri || null;
});
if (arg.local === "script" && arg.uri === "http://www.w3.org/1999/xhtml") {
openStack.push({
type: "tag",
name: arg.local,
prefix: arg.prefix,
namespace: arg.uri,
attribs: attrValues,
"x-attribsPrefix": attrPrefixes,
"x-attribsNamespace": attrNamespaces
});
} else {
const elem = setChild(this.core, openStack[openStack.length - 1], {
type: "tag",
name: arg.local,
prefix: arg.prefix,
namespace: arg.uri,
attribs: attrValues,
"x-attribsPrefix": attrPrefixes,
"x-attribsNamespace": attrNamespaces
});
openStack.push(elem);
}
};
parser.onclosetag = () => {
const elem = openStack.pop();
if (elem.constructor.name === "Object") { // we have an empty script tag
setChild(this.core, openStack[openStack.length - 1], elem);
}
};
parser.onscript = scriptText => {
const tag = openStack.pop();
tag.children = [{ type: "text", data: scriptText }];
const elem = setChild(this.core, openStack[openStack.length - 1], tag);
openStack.push(elem);
};
parser.oncomment = comment => {
setChild(this.core, openStack[openStack.length - 1], {
type: "comment",
data: comment
});
};
parser.onprocessinginstruction = pi => {
setChild(this.core, openStack[openStack.length - 1], {
type: "directive",
name: "?" + pi.name,
data: "?" + pi.name + " " + pi.body + "?"
});
};
parser.ondoctype = dt => {
setChild(this.core, openStack[openStack.length - 1], {
type: "directive",
name: "!doctype",
data: "!doctype " + dt
});
const entityMatcher = /<!ENTITY ([^ ]+) "([^"]+)">/g;
let result;
while ((result = entityMatcher.exec(dt))) {
// TODO Node v6 const [, name, value] = result;
const name = result[1];
const value = result[2];
if (!(name in parser.ENTITIES)) {
parser.ENTITIES[name] = value;
}
}
};
parser.onerror = err => {
throw err;
};
parser.write(html).close();
}
}
// utility function for forgiving parser
function setChild(core, 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 "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") {
if (node["x-name"] !== undefined) { // parse5 supports doctypes directly
newNode = createDocumentTypeInternal(core, currentDocument,
node["x-name"] || "",
node["x-publicId"] || "",
node["x-systemId"] || "");
} else {
newNode = parseDocType(core, currentDocument, "<" + node.data + ">");
}
}
break;
}
if (!newNode) {
return null;
}
newNode[locationInfo] = node.__location;
if (node.attribs) {
Object.keys(node.attribs).forEach(localName => {
const value = node.attribs[localName];
let prefix =
node["x-attribsPrefix"] &&
Object.prototype.hasOwnProperty.call(node["x-attribsPrefix"], localName) &&
node["x-attribsPrefix"][localName] || null;
const namespace =
node["x-attribsNamespace"] &&
Object.prototype.hasOwnProperty.call(node["x-attribsNamespace"], localName) &&
node["x-attribsNamespace"][localName] || null;
if (prefix === "xmlns" && localName === "") {
// intended weirdness in node-sax, see https://github.com/isaacs/sax-js/issues/165
localName = prefix;
prefix = null;
}
attributes.setAttributeValue(newNode, localName, value, prefix, namespace);
});
}
if (node.children) {
for (let c = 0; c < node.children.length; c++) {
setChild(core, newNode, node.children[c]);
}
}
if (!isTemplateContents) {
if (parentImpl._templateContents) {
// Setting innerHTML on a <template>
parentImpl._templateContents.appendChild(newNode);
} else {
parentImpl.appendChild(newNode);
}
}
return newNode;
}
const HTML5_DOCTYPE = /<!doctype html>/i;
const PUBLIC_DOCTYPE = /<!doctype\s+([^\s]+)\s+public\s+"([^"]+)"\s+"([^"]+)"/i;
const SYSTEM_DOCTYPE = /<!doctype\s+([^\s]+)\s+system\s+"([^"]+)"/i;
function parseDocType(core, doc, html) {
if (HTML5_DOCTYPE.test(html)) {
return createDocumentTypeInternal(core, doc, "html", "", "");
}
const publicPieces = PUBLIC_DOCTYPE.exec(html);
if (publicPieces) {
return createDocumentTypeInternal(core, doc, publicPieces[1], publicPieces[2], publicPieces[3]);
}
const systemPieces = SYSTEM_DOCTYPE.exec(html);
if (systemPieces) {
return createDocumentTypeInternal(core, 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(core, doc, "html", "", "");
}
function createDocumentTypeInternal(core, ownerDocument, name, publicId, systemId) {
return DocumentType.createImpl([], { core, ownerDocument, name, publicId, systemId });
}
exports.HtmlToDom = HtmlToDom;

View File

@@ -0,0 +1,13 @@
"use strict";
module.exports = function (nameForErrorMessage, window) {
if (!window) {
// Do nothing for window-less documents.
return;
}
const error = new Error(`Not implemented: ${nameForErrorMessage}`);
error.type = "not implemented";
window._virtualConsole.emit("jsdomError", error);
};

View File

@@ -0,0 +1,275 @@
"use strict";
const parseContentType = require("content-type-parser");
const sniffHTMLEncoding = require("html-encoding-sniffer");
const whatwgEncoding = require("whatwg-encoding");
const parseDataUrl = require("../utils").parseDataUrl;
const fs = require("fs");
const request = require("request");
const documentBaseURLSerialized = require("../living/helpers/document-base-url").documentBaseURLSerialized;
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, options, callback) {
const readableStream = fs.createReadStream(filePath);
let data = new Buffer(0);
readableStream.on("error", callback);
readableStream.on("data", chunk => {
data = Buffer.concat([data, chunk]);
});
const defaultEncoding = options.defaultEncoding;
const detectMetaCharset = options.detectMetaCharset;
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, options, callback) {
const defaultEncoding = options.defaultEncoding;
try {
const data = parseDataUrl(dataUrl);
// If default encoding does not exist, pass on binary data.
if (defaultEncoding) {
const contentType = parseContentType(data.type) || parseContentType("text/plain");
const sniffOptions = {
transportLayerEncodingLabel: contentType.get("charset"),
defaultEncoding
};
const encoding = options.detectMetaCharset ? sniffHTMLEncoding(data.buffer, sniffOptions) :
whatwgEncoding.getBOMEncoding(data.buffer) ||
whatwgEncoding.labelToName(contentType.get("charset")) || defaultEncoding;
const decoded = whatwgEncoding.decode(data.buffer, encoding);
contentType.set("charset", encoding);
data.type = contentType.toString();
callback(null, decoded, { headers: { "content-type": data.type } });
} else {
callback(null, data.buffer, { headers: { "content-type": data.type } });
}
} 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.
function 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: 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 = options.defaultEncoding;
const detectMetaCharset = options.detectMetaCharset;
const req = request(url, requestOptions, (error, response, bufferData) => {
if (!error) {
// If default encoding does not exist, pass on binary data.
if (defaultEncoding) {
const contentType = parseContentType(response.headers["content-type"]) || parseContentType("text/plain");
const sniffOptions = {
transportLayerEncodingLabel: contentType.get("charset"),
defaultEncoding
};
const encoding = detectMetaCharset ? sniffHTMLEncoding(bufferData, sniffOptions) :
whatwgEncoding.getBOMEncoding(bufferData) ||
whatwgEncoding.labelToName(contentType.get("charset")) || defaultEncoding;
const decoded = whatwgEncoding.decode(bufferData, encoding);
contentType.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,69 @@
"use strict";
const cssom = require("cssom");
const cssstyle = require("cssstyle");
module.exports = core => {
// What works now:
// - Accessing the rules defined in individual stylesheets
// - Modifications to style content attribute are reflected in style property
// - Modifications to style property are reflected in style content attribute
// TODO
// - Modifications to style element's textContent are reflected in sheet property.
// - Modifications to style element's sheet property are reflected in textContent.
// - Modifications to link.href property are reflected in sheet property.
// - Less-used features of link: disabled
// - Less-used features of style: disabled, scoped, title
// - CSSOM-View
// - getComputedStyle(): requires default stylesheet, cascading, inheritance,
// filtering by @media (screen? print?), layout for widths/heights
// - Load events are not in the specs, but apparently some browsers
// implement something. Should onload only fire after all @imports have been
// loaded, or only the primary sheet?
core.StyleSheet = cssom.StyleSheet;
core.MediaList = cssom.MediaList;
core.CSSStyleSheet = cssom.CSSStyleSheet;
core.CSSRule = cssom.CSSRule;
core.CSSStyleRule = cssom.CSSStyleRule;
core.CSSMediaRule = cssom.CSSMediaRule;
core.CSSImportRule = cssom.CSSImportRule;
core.CSSStyleDeclaration = cssstyle.CSSStyleDeclaration;
// Relavant specs
// http://www.w3.org/TR/DOM-Level-2-Style (2000)
// http://www.w3.org/TR/cssom-view/ (2008)
// http://dev.w3.org/csswg/cssom/ (2010) Meant to replace DOM Level 2 Style
// http://www.whatwg.org/specs/web-apps/current-work/multipage/ HTML5, of course
// http://dev.w3.org/csswg/css-style-attr/ not sure what's new here
// Objects that aren't in cssom library but should be:
// CSSRuleList (cssom just uses array)
// CSSFontFaceRule
// CSSPageRule
// These rules don't really make sense to implement, so CSSOM draft makes them
// obsolete.
// CSSCharsetRule
// CSSUnknownRule
// These objects are considered obsolete by CSSOM draft, although modern
// browsers implement them.
// CSSValue
// CSSPrimitiveValue
// CSSValueList
// RGBColor
// Rect
// Counter
// http://dev.w3.org/csswg/cssom/#stylesheetlist
function StyleSheetList() {}
StyleSheetList.prototype.__proto__ = Array.prototype;
StyleSheetList.prototype.item = function item(i) {
return Object.prototype.hasOwnProperty.call(this, i) ? this[i] : null;
};
core.StyleSheetList = StyleSheetList;
};

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,468 @@
"use strict";
const DOMException = require("../web-idl/DOMException");
const defineGetter = require("../utils").defineGetter;
const idlUtils = require("./generated/utils");
const attrGenerated = require("./generated/Attr");
const changeAttributeImpl = require("./attributes/Attr-impl").changeAttributeImpl;
const getAttrImplQualifiedName = require("./attributes/Attr-impl").getAttrImplQualifiedName;
// https://dom.spec.whatwg.org/#namednodemap
const INTERNAL = Symbol("NamedNodeMap internal");
// TODO: use NamedPropertyTracker when https://github.com/tmpvar/jsdom/pull/1116 lands?
// Don't emulate named getters for these properties.
// Compiled later after NamedNodeMap is all set up.
const reservedNames = new Set();
function NamedNodeMap() {
throw new TypeError("Illegal constructor");
}
defineGetter(NamedNodeMap.prototype, "length", function () {
return this[INTERNAL].attributeList.length;
});
NamedNodeMap.prototype.item = function (index) {
if (arguments.length < 1) {
throw new TypeError("Not enough arguments to NamedNodeMap.prototype.item");
}
// Don't bother with full unsigned long long conversion. When we have better WebIDL support generally, revisit.
index = Number(index);
return this[index] || null;
};
NamedNodeMap.prototype.getNamedItem = function (name) {
if (arguments.length < 1) {
throw new TypeError("Not enough arguments to NamedNodeMap.prototype.getNamedItem");
}
name = String(name);
return idlUtils.wrapperForImpl(exports.getAttributeByName(this[INTERNAL].element, name));
};
NamedNodeMap.prototype.getNamedItemNS = function (namespace, localName) {
if (arguments.length < 2) {
throw new TypeError("Not enough arguments to NamedNodeMap.prototype.getNamedItemNS");
}
if (namespace === undefined || namespace === null) {
namespace = null;
} else {
namespace = String(namespace);
}
localName = String(localName);
return idlUtils.wrapperForImpl(exports.getAttributeByNameNS(this[INTERNAL].element, namespace, localName));
};
NamedNodeMap.prototype.setNamedItem = function (attr) {
if (!attrGenerated.is(attr)) {
throw new TypeError("First argument to NamedNodeMap.prototype.setNamedItem must be an Attr");
}
return idlUtils.wrapperForImpl(exports.setAttribute(this[INTERNAL].element, idlUtils.implForWrapper(attr)));
};
NamedNodeMap.prototype.setNamedItemNS = function (attr) {
if (!attrGenerated.is(attr)) {
throw new TypeError("First argument to NamedNodeMap.prototype.setNamedItemNS must be an Attr");
}
return idlUtils.wrapperForImpl(exports.setAttribute(this[INTERNAL].element, idlUtils.implForWrapper(attr)));
};
NamedNodeMap.prototype.removeNamedItem = function (name) {
if (arguments.length < 1) {
throw new TypeError("Not enough arguments to NamedNodeMap.prototype.getNamedItem");
}
name = String(name);
const attr = exports.removeAttributeByName(this[INTERNAL].element, name);
if (attr === null) {
throw new DOMException(DOMException.NOT_FOUND_ERR, "Tried to remove an attribute that was not present");
}
return idlUtils.wrapperForImpl(attr);
};
NamedNodeMap.prototype.removeNamedItemNS = function (namespace, localName) {
if (arguments.length < 2) {
throw new TypeError("Not enough arguments to NamedNodeMap.prototype.removeNamedItemNS");
}
if (namespace === undefined || namespace === null) {
namespace = null;
} else {
namespace = String(namespace);
}
localName = String(localName);
const attr = exports.removeAttributeByNameNS(this[INTERNAL].element, namespace, localName);
if (attr === null) {
throw new DOMException(DOMException.NOT_FOUND_ERR, "Tried to remove an attribute that was not present");
}
return idlUtils.wrapperForImpl(attr);
};
exports.NamedNodeMap = NamedNodeMap;
{
let prototype = NamedNodeMap.prototype;
while (prototype) {
for (const name of Object.getOwnPropertyNames(prototype)) {
reservedNames.add(name);
}
prototype = Object.getPrototypeOf(prototype);
}
}
exports.createNamedNodeMap = function (element) {
const nnm = Object.create(NamedNodeMap.prototype);
nnm[INTERNAL] = {
element,
attributeList: [],
attributesByNameMap: new Map()
};
return nnm;
};
// The following three are for https://dom.spec.whatwg.org/#concept-element-attribute-has. We don't just have a
// predicate tester since removing that kind of flexibility gives us the potential for better future optimizations.
exports.hasAttribute = function (element, A) {
const attributesNNM = element._attributes;
const attributeList = attributesNNM[INTERNAL].attributeList;
return attributeList.indexOf(A) !== -1;
};
exports.hasAttributeByName = function (element, name) {
const attributesNNM = element._attributes;
const attributesByNameMap = attributesNNM[INTERNAL].attributesByNameMap;
return attributesByNameMap.has(name);
};
exports.hasAttributeByNameNS = function (element, namespace, localName) {
const attributesNNM = element._attributes;
const attributeList = attributesNNM[INTERNAL].attributeList;
return attributeList.some(attribute => {
return attribute._localName === localName && attribute._namespace === namespace;
});
};
exports.changeAttribute = function (element, attribute, value) {
// https://dom.spec.whatwg.org/#concept-element-attributes-change
// The partitioning here works around a particularly bad circular require problem. See
// https://github.com/tmpvar/jsdom/pull/1247#issuecomment-149060470
changeAttributeImpl(element, attribute, value);
};
exports.appendAttribute = function (element, attribute) {
// https://dom.spec.whatwg.org/#concept-element-attributes-append
const attributesNNM = element._attributes;
const attributeList = attributesNNM[INTERNAL].attributeList;
// TODO mutation observer stuff
attributeList.push(attribute);
attribute._element = element;
// Sync target indexed properties
attributesNNM[attributeList.length - 1] = idlUtils.wrapperForImpl(attribute);
const name = getAttrImplQualifiedName(attribute);
// Sync target named properties
if (!reservedNames.has(name) && shouldNameBeInNNMProps(element, name)) {
Object.defineProperty(attributesNNM, name, {
configurable: true,
writable: true,
enumerable: false,
value: idlUtils.wrapperForImpl(attribute)
});
}
// Sync name cache
const cache = attributesNNM[INTERNAL].attributesByNameMap;
let entry = cache.get(name);
if (!entry) {
entry = [];
cache.set(name, entry);
}
entry.push(attribute);
// Run jsdom hooks; roughly correspond to spec's "An attribute is set and an attribute is added."
element._attrModified(name, attribute._value, null);
};
exports.removeAttribute = function (element, attribute) {
// https://dom.spec.whatwg.org/#concept-element-attributes-remove
const attributesNNM = element._attributes;
const attributeList = attributesNNM[INTERNAL].attributeList;
// TODO mutation observer stuff
for (let i = 0; i < attributeList.length; ++i) {
if (attributeList[i] === attribute) {
attributeList.splice(i, 1);
attribute._element = null;
// Sync target indexed properties
for (let j = i; j < attributeList.length; ++j) {
attributesNNM[j] = idlUtils.wrapperForImpl(attributeList[j]);
}
delete attributesNNM[attributeList.length];
const name = getAttrImplQualifiedName(attribute);
// Sync target named properties
if (!reservedNames.has(name) && shouldNameBeInNNMProps(element, name)) {
delete attributesNNM[name];
}
// Sync name cache
const cache = attributesNNM[INTERNAL].attributesByNameMap;
const entry = cache.get(name);
entry.splice(entry.indexOf(attribute), 1);
if (entry.length === 0) {
cache.delete(name);
}
// Run jsdom hooks; roughly correspond to spec's "An attribute is removed."
element._attrModified(name, null, attribute._value);
return;
}
}
};
exports.replaceAttribute = function (element, oldAttr, newAttr) {
// https://dom.spec.whatwg.org/#concept-element-attributes-replace
const attributesNNM = element._attributes;
const attributeList = attributesNNM[INTERNAL].attributeList;
// TODO mutation observer stuff
for (let i = 0; i < attributeList.length; ++i) {
if (attributeList[i] === oldAttr) {
attributeList.splice(i, 1, newAttr);
oldAttr._element = null;
newAttr._element = element;
// Sync target indexed properties
attributesNNM[i] = idlUtils.wrapperForImpl(newAttr);
const name = getAttrImplQualifiedName(newAttr);
// Sync target named properties
if (!reservedNames.has(name) && shouldNameBeInNNMProps(element, name)) {
attributesNNM[name] = newAttr;
}
// Sync name cache
const cache = attributesNNM[INTERNAL].attributesByNameMap;
let entry = cache.get(name);
if (!entry) {
entry = [];
cache.set(name, entry);
}
entry.splice(entry.indexOf(oldAttr), 1, newAttr);
// Run jsdom hooks; roughly correspond to spec's "An attribute is set and an attribute is changed."
element._attrModified(name, newAttr._value, oldAttr._value);
return;
}
}
};
exports.getAttributeByName = function (element, name) {
// https://dom.spec.whatwg.org/#concept-element-attributes-get-by-name
if (element._namespaceURI === "http://www.w3.org/1999/xhtml" &&
element._ownerDocument._parsingMode === "html") {
name = name.toLowerCase();
}
const cache = element._attributes[INTERNAL].attributesByNameMap;
const entry = cache.get(name);
if (!entry) {
return null;
}
return entry[0];
};
exports.getAttributeValue = function (element, name) {
const attr = exports.getAttributeByName(element, name);
if (!attr) {
return null;
}
return attr._value;
};
exports.getAttributeByNameNS = function (element, namespace, localName) {
// https://dom.spec.whatwg.org/#concept-element-attributes-get-by-namespace
if (namespace === "") {
namespace = null;
}
const attributeList = element._attributes[INTERNAL].attributeList;
for (let i = 0; i < attributeList.length; ++i) {
const attr = attributeList[i];
if (attr._namespace === namespace && attr._localName === localName) {
return attr;
}
}
return null;
};
exports.getAttributeValueByNameNS = function (element, namespace, localName) {
const attr = exports.getAttributeByNameNS(element, namespace, localName);
if (!attr) {
return null;
}
return attr._value;
};
exports.setAttribute = function (element, attr) {
// https://dom.spec.whatwg.org/#concept-element-attributes-set
if (attr._element !== null && attr._element !== element) {
throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR);
}
const oldAttr = exports.getAttributeByNameNS(element, attr._namespace, attr._localName);
if (oldAttr === attr) {
return attr;
}
if (oldAttr !== null) {
exports.replaceAttribute(element, oldAttr, attr);
} else {
exports.appendAttribute(element, attr);
}
return oldAttr;
};
exports.setAttributeValue = function (element, localName, value, prefix, namespace) {
// https://dom.spec.whatwg.org/#concept-element-attributes-set-value
if (prefix === undefined) {
prefix = null;
}
if (namespace === undefined) {
namespace = null;
}
const attribute = exports.getAttributeByNameNS(element, namespace, localName);
if (attribute === null) {
const newAttribute = attrGenerated.createImpl([], { namespace, namespacePrefix: prefix, localName, value });
exports.appendAttribute(element, newAttribute);
return;
}
exports.changeAttribute(element, attribute, value);
};
exports.removeAttributeByName = function (element, name) {
// https://dom.spec.whatwg.org/#concept-element-attributes-remove-by-name
const attr = exports.getAttributeByName(element, name);
if (attr !== null) {
exports.removeAttribute(element, attr);
}
return attr;
};
exports.removeAttributeByNameNS = function (element, namespace, localName) {
// https://dom.spec.whatwg.org/#concept-element-attributes-remove-by-namespace
const attr = exports.getAttributeByNameNS(element, namespace, localName);
if (attr !== null) {
exports.removeAttribute(element, attr);
}
return attr;
};
exports.copyAttributeList = function (sourceElement, destElement) {
// Needed by https://dom.spec.whatwg.org/#concept-node-clone
for (const sourceAttr of sourceElement._attributes[INTERNAL].attributeList) {
const destAttr = attrGenerated.createImpl([], {
namespace: sourceAttr._namespace,
namespacePrefix: sourceAttr._namespacePrefix,
localName: sourceAttr._localName,
value: sourceAttr._value
});
exports.appendAttribute(destElement, destAttr);
}
};
exports.attributeListsEqual = function (elementA, elementB) {
// Needed by https://dom.spec.whatwg.org/#concept-node-equals
const listA = elementA._attributes[INTERNAL].attributeList;
const listB = elementB._attributes[INTERNAL].attributeList;
if (listA.length !== listB.length) {
return false;
}
for (let i = 0; i < listA.length; ++i) {
const attrA = listA[i];
if (!listB.some(attrB => equalsA(attrB))) {
return false;
}
function equalsA(attrB) {
return attrA._namespace === attrB._namespace && attrA._localName === attrB._localName &&
attrA._value === attrB._value;
}
}
return true;
};
exports.attributeNames = function (element) {
// Needed by https://dom.spec.whatwg.org/#dom-element-getattributenames
return element._attributes[INTERNAL].attributeList.map(getAttrImplQualifiedName);
};
exports.hasAttributes = function (element) {
// Needed by https://dom.spec.whatwg.org/#dom-element-hasattributes
return element._attributes[INTERNAL].attributeList.length > 0;
};
function shouldNameBeInNNMProps(element, name) {
if (element._ownerDocument._parsingMode === "html" && element._namespaceURI === "http://www.w3.org/1999/xhtml") {
return name.toLowerCase() === name;
}
return true;
}

View File

@@ -0,0 +1,87 @@
"use strict";
exports.implementation = class AttrImpl {
constructor(_, privateData) {
this._namespace = privateData.namespace !== undefined ? privateData.namespace : null;
this._namespacePrefix = privateData.namespacePrefix !== undefined ? privateData.namespacePrefix : null;
this._localName = privateData.localName;
this._value = privateData.value !== undefined ? privateData.value : "";
this._element = privateData.element !== undefined ? privateData.element : null;
this.specified = true;
}
get namespaceURI() {
return this._namespace;
}
get prefix() {
return this._namespacePrefix;
}
get localName() {
return this._localName;
}
get name() {
return exports.getAttrImplQualifiedName(this);
}
// Delegate to name
get nodeName() {
return this.name;
}
get value() {
return this._value;
}
set value(v) {
if (this._element === null) {
this._value = v;
} else {
exports.changeAttributeImpl(this._element, this, v);
}
}
// Delegate to value
get nodeValue() {
return this.value;
}
set nodeValue(v) {
this.value = v;
}
// Delegate to value
get textContent() {
return this.value;
}
set textContent(v) {
this.value = v;
}
get ownerElement() {
return this._element;
}
};
exports.changeAttributeImpl = function (element, attributeImpl, value) {
// https://dom.spec.whatwg.org/#concept-element-attributes-change
// TODO mutation observer stuff
const oldValue = attributeImpl._value;
attributeImpl._value = value;
// Run jsdom hooks; roughly correspond to spec's "An attribute is set and an attribute is changed."
element._attrModified(exports.getAttrImplQualifiedName(attributeImpl), value, oldValue);
};
exports.getAttrImplQualifiedName = function (attributeImpl) {
// https://dom.spec.whatwg.org/#concept-attribute-qualified-name
if (attributeImpl._namespacePrefix === null) {
return attributeImpl._localName;
}
return attributeImpl._namespacePrefix + ":" + attributeImpl._localName;
};

View File

@@ -0,0 +1,222 @@
"use strict";
const DOMException = require("../web-idl/DOMException");
const orderedSetParser = require("./helpers/ordered-set-parser");
// https://dom.spec.whatwg.org/#domtokenlist
const INTERNAL = Symbol("DOMTokenList internal");
class DOMTokenList {
constructor() {
throw new TypeError("Illegal constructor");
}
item(index) {
const length = this.length;
return length <= index || index < 0 ? null : this[index];
}
contains(token) {
token = String(token);
return indexOf(this, token) !== -1;
}
replace(token, newToken) {
token = String(token);
newToken = String(newToken);
validateTokens(token, newToken);
const tokenIndex = indexOf(this, token);
if (tokenIndex === -1) {
return;
}
const newTokenIndex = indexOf(this, newToken);
if (newTokenIndex !== -1) {
spliceLite(this, newTokenIndex, 1);
}
this[INTERNAL].tokens[tokenIndex] = newToken;
update(this);
}
add(/* tokens... */) {
for (let i = 0; i < arguments.length; i++) {
const token = String(arguments[i]);
validateTokens(token);
if (indexOf(this, token) === -1) {
push(this, token);
}
}
update(this);
}
remove(/* tokens... */) {
for (let i = 0; i < arguments.length; i++) {
const token = String(arguments[i]);
validateTokens(token);
const index = indexOf(this, token);
if (index !== -1) {
spliceLite(this, index, 1);
}
}
update(this);
}
// if force is true, this behaves like add
// if force is false, this behaves like remove
// if force is undefined, this behaves as one would expect toggle to
// always returns whether classList contains token after toggling
toggle(token, force) {
token = String(token);
force = force === undefined ? undefined : Boolean(force);
validateTokens(token);
const index = indexOf(this, token);
if (index !== -1) {
if (force === false || force === undefined) {
spliceLite(this, index, 1);
update(this);
return false;
}
return true;
}
if (force === false) {
return false;
}
push(this, token);
update(this);
return true;
}
get length() {
return this[INTERNAL].tokens.length;
}
get value() {
return serialize(this);
}
set value(v) {
this[INTERNAL].element.setAttribute(this[INTERNAL].attribute, v);
}
toString() {
return serialize(this);
}
}
function serialize(list) {
const value = list[INTERNAL].element.getAttribute(list[INTERNAL].attribute);
return value === null ? "" : value;
}
function validateTokens(/* tokens... */) {
for (let i = 0; i < arguments.length; i++) {
const token = String(arguments[i]);
if (token === "") {
throw new DOMException(DOMException.SYNTAX_ERR, "The token provided must not be empty.");
}
}
for (let i = 0; i < arguments.length; i++) {
const token = String(arguments[i]);
if (/\s/.test(token)) {
const whitespaceMsg = "The token provided contains HTML space characters, which are not valid in tokens.";
throw new DOMException(DOMException.INVALID_CHARACTER_ERR, whitespaceMsg);
}
}
}
function update(list) {
const attribute = list[INTERNAL].attribute;
list[INTERNAL].element.setAttribute(attribute, list[INTERNAL].tokens.join(" "));
}
// calls indexOf on internal array
function indexOf(dtl, token) {
return dtl[INTERNAL].tokens.indexOf(token);
}
// calls push on internal array, then manually adds indexed property to dtl
function push(dtl, token) {
const len = dtl[INTERNAL].tokens.push(token);
dtl[len - 1] = token;
return len;
}
// calls splice on internal array then rewrites indexed properties of dtl
// does not allow items to be added, only removed, so splice-lite
function spliceLite(dtl, start, deleteCount) {
const tokens = dtl[INTERNAL].tokens;
const removedTokens = tokens.splice(start, deleteCount);
// remove indexed properties from list
const re = /^\d+$/;
for (const prop in dtl) {
if (re.test(prop)) {
delete dtl[prop];
}
}
// copy indexed properties from internal array
const len = tokens.length;
for (let i = 0; i < len; i++) {
dtl[i] = tokens[i];
}
return removedTokens;
}
exports.DOMTokenList = DOMTokenList;
// set dom token list without running update steps
exports.reset = function resetDOMTokenList(list, value) {
const tokens = list[INTERNAL].tokens;
spliceLite(list, 0, tokens.length);
if (value) {
for (const token of orderedSetParser(value)) {
push(list, token);
}
}
};
exports.create = function createDOMTokenList(element, attribute) {
const list = Object.create(DOMTokenList.prototype);
list[INTERNAL] = {
element,
attribute,
tokens: []
};
exports.reset(list, element.getAttribute(attribute));
return list;
};
exports.contains = function domTokenListContains(list, token, options) {
const caseInsensitive = options && options.caseInsensitive;
if (!caseInsensitive) {
return indexOf(list, token) !== -1;
}
const tokens = list[INTERNAL].tokens;
const lowerToken = token.toLowerCase();
for (let i = 0; i < tokens.length; ++i) {
if (tokens[i].toLowerCase() === lowerToken) {
return true;
}
}
return false;
};

View File

@@ -0,0 +1,61 @@
"use strict";
const Document = require("../generated/Document");
const core = require("..");
const applyDocumentFeatures = require("../../browser/documentfeatures").applyDocumentFeatures;
exports.implementation = class DOMParserImpl {
parseFromString(string, contentType) {
switch (String(contentType)) {
case "text/html": {
return createScriptingDisabledDocument("html", contentType, string);
}
case "text/xml":
case "application/xml":
case "application/xhtml+xml":
case "image/svg+xml": {
// TODO: use a strict XML parser (sax's strict mode might work?) and create parsererror elements
try {
return createScriptingDisabledDocument("xml", contentType, string);
} catch (error) {
const document = createScriptingDisabledDocument("xml", contentType);
const element = document.createElementNS(
"http://www.mozilla.org/newlayout/xml/parsererror.xml", "parsererror");
element.textContent = error.message;
document.appendChild(element);
return document;
}
}
default:
throw new TypeError("Invalid contentType");
}
}
};
function createScriptingDisabledDocument(parsingMode, contentType, string) {
const document = Document.createImpl([], {
core,
options: {
parsingMode,
encoding: "UTF-8",
contentType
// TODO: somehow set URL to active document's URL
}
});
// "scripting enabled" set to false
applyDocumentFeatures(document, {
FetchExternalResources: [],
ProcessExternalResources: false,
SkipExternalResources: false
});
if (string !== undefined) {
document._htmlToDom.appendHtmlToDocument(string, document);
}
document.close();
return document;
}

View File

@@ -0,0 +1,18 @@
"use strict";
const EventImpl = require("./Event-impl").implementation;
class CustomEventImpl extends EventImpl {
initCustomEvent(type, bubbles, cancelable, detail) {
if (this._dispatchFlag) {
return;
}
this.initEvent(type, bubbles, cancelable);
this.detail = detail;
}
}
module.exports = {
implementation: CustomEventImpl
};

View File

@@ -0,0 +1,11 @@
"use strict";
const EventImpl = require("./Event-impl").implementation;
class ErrorEventImpl extends EventImpl {
}
module.exports = {
implementation: ErrorEventImpl
};

View File

@@ -0,0 +1,87 @@
"use strict";
const EventInit = require("../generated/EventInit");
class EventImpl {
constructor(args, privateData) {
const type = args[0]; // TODO: Replace with destructuring
const eventInitDict = args[1] || EventInit.convert(undefined);
this.type = type;
const wrapper = privateData.wrapper;
for (const key in eventInitDict) {
if (key in wrapper) {
this[key] = eventInitDict[key];
}
}
this.target = null;
this.currentTarget = null;
this.eventPhase = 0;
this._initializedFlag = true;
this._stopPropagationFlag = false;
this._stopImmediatePropagationFlag = false;
this._canceledFlag = false;
this._dispatchFlag = false;
this.isTrusted = privateData.isTrusted || false;
this.timeStamp = Date.now();
}
get defaultPrevented() {
return this._canceledFlag;
}
stopPropagation() {
this._stopPropagationFlag = true;
}
get cancelBubble() {
return this._stopPropagationFlag;
}
set cancelBubble(v) {
if (v) {
this._stopPropagationFlag = true;
}
}
stopImmediatePropagation() {
this._stopPropagationFlag = true;
this._stopImmediatePropagationFlag = true;
}
preventDefault() {
if (this.cancelable) {
this._canceledFlag = true;
}
}
_initialize(type, bubbles, cancelable) {
this.type = type;
this._initializedFlag = true;
this._stopPropagationFlag = false;
this._stopImmediatePropagationFlag = false;
this._canceledFlag = false;
this.isTrusted = false;
this.target = null;
this.bubbles = bubbles;
this.cancelable = cancelable;
}
initEvent(type, bubbles, cancelable) {
if (this._dispatchFlag) {
return;
}
this._initialize(type, bubbles, cancelable);
}
}
module.exports = {
implementation: EventImpl
};

View File

@@ -0,0 +1,303 @@
"use strict";
const DOMException = require("../../web-idl/DOMException");
const reportException = require("../helpers/runtime-script-errors");
const domSymbolTree = require("../helpers/internal-constants").domSymbolTree;
const idlUtils = require("../generated/utils");
const EventImpl = require("./Event-impl").implementation;
const Event = require("../generated/Event").interface;
class EventTargetImpl {
constructor() {
this._eventListeners = Object.create(null);
}
addEventListener(type, callback, options) {
// webidl2js currently can't handle neither optional arguments nor callback interfaces
if (callback === undefined || callback === null) {
callback = null;
} else if (typeof callback !== "object" && typeof callback !== "function") {
throw new TypeError("Only undefined, null, an object, or a function are allowed for the callback parameter");
}
options = normalizeEventHandlerOptions(options, ["capture", "once"]);
if (callback === null) {
return;
}
if (!this._eventListeners[type]) {
this._eventListeners[type] = [];
}
for (let i = 0; i < this._eventListeners[type].length; ++i) {
const listener = this._eventListeners[type][i];
if (listener.options.capture === options.capture && listener.callback === callback) {
return;
}
}
this._eventListeners[type].push({
callback,
options
});
}
removeEventListener(type, callback, options) {
if (callback === undefined || callback === null) {
callback = null;
} else if (typeof callback !== "object" && typeof callback !== "function") {
throw new TypeError("Only undefined, null, an object, or a function are allowed for the callback parameter");
}
options = normalizeEventHandlerOptions(options, ["capture"]);
if (callback === null) {
// Optimization, not in the spec.
return;
}
if (!this._eventListeners[type]) {
return;
}
for (let i = 0; i < this._eventListeners[type].length; ++i) {
const listener = this._eventListeners[type][i];
if (listener.callback === callback && listener.options.capture === options.capture) {
this._eventListeners[type].splice(i, 1);
break;
}
}
}
dispatchEvent(eventImpl) {
if (!(eventImpl instanceof EventImpl)) {
throw new TypeError("Argument to dispatchEvent must be an Event");
}
if (eventImpl._dispatchFlag || !eventImpl._initializedFlag) {
throw new DOMException(DOMException.INVALID_STATE_ERR, "Tried to dispatch an uninitialized event");
}
if (eventImpl.eventPhase !== Event.NONE) {
throw new DOMException(DOMException.INVALID_STATE_ERR, "Tried to dispatch a dispatching event");
}
eventImpl.isTrusted = false;
return this._dispatch(eventImpl);
}
_dispatch(eventImpl, targetOverride) {
eventImpl._dispatchFlag = true;
eventImpl.target = targetOverride || this;
const eventPath = [];
let targetParent = domSymbolTree.parent(eventImpl.target);
let target = eventImpl.target;
while (targetParent) {
eventPath.push(targetParent);
target = targetParent;
targetParent = domSymbolTree.parent(targetParent);
}
if (eventImpl.type !== "load" && target._defaultView) {
// https://html.spec.whatwg.org/#events-and-the-window-object
eventPath.push(idlUtils.implForWrapper(target._defaultView));
}
eventImpl.eventPhase = Event.CAPTURING_PHASE;
for (let i = eventPath.length - 1; i >= 0; --i) {
if (eventImpl._stopPropagationFlag) {
break;
}
const object = eventPath[i];
const objectImpl = idlUtils.implForWrapper(object) || object; // window :(
const eventListeners = objectImpl._eventListeners[eventImpl.type];
invokeEventListeners(eventListeners, object, eventImpl);
}
eventImpl.eventPhase = Event.AT_TARGET;
if (!eventImpl._stopPropagationFlag) {
invokeInlineListeners(eventImpl.target, eventImpl);
if (this._eventListeners[eventImpl.type]) {
const eventListeners = this._eventListeners[eventImpl.type];
invokeEventListeners(eventListeners, eventImpl.target, eventImpl);
}
}
if (eventImpl.bubbles) {
eventImpl.eventPhase = Event.BUBBLING_PHASE;
for (let i = 0; i < eventPath.length; ++i) {
if (eventImpl._stopPropagationFlag) {
break;
}
const object = eventPath[i];
const objectImpl = idlUtils.implForWrapper(object) || object; // window :(
const eventListeners = objectImpl._eventListeners[eventImpl.type];
invokeInlineListeners(object, eventImpl);
invokeEventListeners(eventListeners, object, eventImpl);
}
}
eventImpl._dispatchFlag = false;
eventImpl._stopPropagationFlag = false;
eventImpl._stopImmediatePropagationFlag = false;
eventImpl.eventPhase = Event.NONE;
eventImpl.currentTarget = null;
return !eventImpl._canceledFlag;
}
}
module.exports = {
implementation: EventTargetImpl
};
function invokeInlineListeners(object, event) {
const wrapper = idlUtils.wrapperForImpl(object);
const inlineListener = getListenerForInlineEventHandler(wrapper, event.type);
if (inlineListener) {
const document = object._ownerDocument || (wrapper && (wrapper._document || wrapper._ownerDocument));
// Will be falsy for windows that have closed
if (document && (!object.nodeName || document.implementation._hasFeature("ProcessExternalResources", "script"))) {
invokeEventListeners([{
callback: inlineListener,
options: normalizeEventHandlerOptions(false, ["capture", "once"])
}], object, event);
}
}
}
function invokeEventListeners(listeners, target, eventImpl) {
const wrapper = idlUtils.wrapperForImpl(target);
const document = target._ownerDocument || (wrapper && (wrapper._document || wrapper._ownerDocument));
// Will be falsy for windows that have closed
if (!document) {
return;
}
// workaround for events emitted on window (window-proxy)
// the wrapper is the root window instance, but we only want to expose the vm proxy at all times
if (wrapper._document) {
target = idlUtils.implForWrapper(wrapper._document)._defaultView;
}
eventImpl.currentTarget = target;
if (!listeners) {
return;
}
const handlers = listeners.slice();
for (let i = 0; i < handlers.length; ++i) {
if (eventImpl._stopImmediatePropagationFlag) {
return;
}
const listener = handlers[i];
const capture = listener.options.capture;
const once = listener.options.once;
// const passive = listener.options.passive;
if (listeners.indexOf(listener) === -1 ||
(eventImpl.eventPhase === Event.CAPTURING_PHASE && !capture) ||
(eventImpl.eventPhase === Event.BUBBLING_PHASE && capture)) {
continue;
}
if (once) {
listeners.splice(listeners.indexOf(listener), 1);
}
try {
if (typeof listener.callback === "object") {
if (typeof listener.callback.handleEvent === "function") {
listener.callback.handleEvent(idlUtils.wrapperForImpl(eventImpl));
}
} else {
listener.callback.call(idlUtils.wrapperForImpl(eventImpl.currentTarget), idlUtils.wrapperForImpl(eventImpl));
}
} catch (e) {
let window = null;
if (wrapper && wrapper._document) {
// Triggered by Window
window = wrapper;
} else if (target._ownerDocument) {
// Triggered by most webidl2js'ed instances
window = target._ownerDocument._defaultView;
} else if (wrapper._ownerDocument) {
// Currently triggered by XHR and some other non-webidl2js things
window = wrapper._ownerDocument._defaultView;
}
if (window) {
reportException(window, e);
}
// Errors in window-less documents just get swallowed... can you think of anything better?
}
}
}
const wrappedListener = Symbol("inline event listener wrapper");
/**
* Normalize the event listeners options argument in order to get always a valid options object
* @param {Object} options - user defined options
* @param {Array} defaultBoolKeys - boolean properties that should belong to the options object
* @returns {Object} object containing at least the "defaultBoolKeys"
*/
function normalizeEventHandlerOptions(options, defaultBoolKeys) {
const returnValue = {};
// no need to go further here
if (typeof options === "boolean" || options === null || typeof options === "undefined") {
returnValue.capture = Boolean(options);
return returnValue;
}
// non objects options so we typecast its value as "capture" value
if (typeof options !== "object") {
returnValue.capture = Boolean(options);
// at this point we don't need to loop the "capture" key anymore
defaultBoolKeys = defaultBoolKeys.filter(k => k !== "capture");
}
for (const key of defaultBoolKeys) {
returnValue[key] = Boolean(options[key]);
}
return returnValue;
}
function getListenerForInlineEventHandler(target, type) {
const callback = target["on" + type];
if (!callback) { // TODO event handlers: only check null
return null;
}
if (!callback[wrappedListener]) {
// https://html.spec.whatwg.org/multipage/webappapis.html#the-event-handler-processing-algorithm
callback[wrappedListener] = function (E) {
const isWindowError = E.constructor.name === "ErrorEvent" && type === "error"; // TODO branding
let returnValue;
if (isWindowError) {
returnValue = callback.call(E.currentTarget, E.message, E.filename, E.lineno, E.colno, E.error);
} else {
returnValue = callback.call(E.currentTarget, E);
}
if (type === "mouseover" || isWindowError) {
if (returnValue === true) {
E.preventDefault();
}
} else if (returnValue === false) {
E.preventDefault();
}
};
}
return callback[wrappedListener];
}

View File

@@ -0,0 +1,4 @@
"use strict";
const EventImpl = require("./Event-impl").implementation;
exports.implementation = class FocusEventImpl extends EventImpl { };

View File

@@ -0,0 +1,11 @@
"use strict";
const EventImpl = require("./Event-impl").implementation;
class HashChangeEventImpl extends EventImpl {
}
module.exports = {
implementation: HashChangeEventImpl
};

View File

@@ -0,0 +1,21 @@
"use strict";
const UIEventImpl = require("./UIEvent-impl").implementation;
class KeyboardEventImpl extends UIEventImpl {
initKeyboardEvent(type, bubbles, cancelable, view, key, location, modifiersList, repeat, locale) {
if (this._dispatchFlag) {
return;
}
this.initUIEvent(type, bubbles, cancelable, view, key);
this.location = location;
this.modifiersList = modifiersList;
this.repeat = repeat;
this.locale = locale;
}
}
module.exports = {
implementation: KeyboardEventImpl
};

View File

@@ -0,0 +1,22 @@
"use strict";
const EventImpl = require("./Event-impl").implementation;
class MessageEventImpl extends EventImpl {
initMessageEvent(type, bubbles, cancelable, data, origin, lastEventId, source, ports) {
if (this._dispatchFlag) {
return;
}
this.initEvent(type, bubbles, cancelable);
this.data = data;
this.origin = origin;
this.lastEventId = lastEventId;
this.source = source;
this.ports = ports;
}
}
module.exports = {
implementation: MessageEventImpl
};

View File

@@ -0,0 +1,28 @@
"use strict";
const UIEventImpl = require("./UIEvent-impl").implementation;
class MouseEventImpl extends UIEventImpl {
initMouseEvent(type, bubbles, cancelable, view, detail, screenX, screenY, clientX, clientY,
ctrlKey, altKey, shiftKey, metaKey, button, relatedTarget) {
if (this._dispatchFlag) {
return;
}
this.initUIEvent(type, bubbles, cancelable, view, detail);
this.screenX = screenX;
this.screenY = screenY;
this.clientX = clientX;
this.clientY = clientY;
this.ctrlKey = ctrlKey;
this.altKey = altKey;
this.shiftKey = shiftKey;
this.metaKey = metaKey;
this.button = button;
this.relatedTarget = relatedTarget;
}
}
module.exports = {
implementation: MouseEventImpl
};

View File

@@ -0,0 +1,4 @@
"use strict";
const EventImpl = require("./Event-impl.js").implementation;
exports.implementation = class PopStateEventImpl extends EventImpl {};

View File

@@ -0,0 +1,11 @@
"use strict";
const EventImpl = require("./Event-impl").implementation;
class ProgressEventImpl extends EventImpl {
}
module.exports = {
implementation: ProgressEventImpl
};

View File

@@ -0,0 +1,11 @@
"use strict";
const UIEventImpl = require("./UIEvent-impl").implementation;
class TouchEventImpl extends UIEventImpl {
}
module.exports = {
implementation: TouchEventImpl
};

View File

@@ -0,0 +1,19 @@
"use strict";
const EventImpl = require("./Event-impl").implementation;
class UIEventImpl extends EventImpl {
initUIEvent(type, bubbles, cancelable, view, detail) {
if (this._dispatchFlag) {
return;
}
this.initEvent(type, bubbles, cancelable);
this.view = view;
this.detail = detail;
}
}
module.exports = {
implementation: UIEventImpl
};

View File

@@ -0,0 +1,105 @@
"use strict";
const idlUtils = require("../generated/utils");
const conversions = require("webidl-conversions");
const Blob = require("../generated/Blob");
exports.implementation = class BlobImpl {
constructor(args) {
const parts = args[0];
const properties = args[1];
const buffers = [];
if (parts !== undefined) {
if (parts === null || typeof parts !== "object" || typeof parts[Symbol.iterator] !== "function") {
throw new TypeError("parts must be an iterable object");
}
const arr = [];
for (const part of parts) {
if (part instanceof ArrayBuffer || ArrayBuffer.isView(part) || Blob.is(part)) {
arr.push(idlUtils.tryImplForWrapper(part));
} else {
arr.push(conversions.USVString(part));
}
}
for (const part of arr) {
let buffer;
if (part instanceof ArrayBuffer) {
buffer = new Buffer(new Uint8Array(part));
} else if (ArrayBuffer.isView(part)) {
buffer = new Buffer(new Uint8Array(part.buffer, part.byteOffset, part.byteLength));
} else if (Blob.isImpl(part)) {
buffer = part._buffer;
} else {
buffer = new Buffer(part);
}
buffers.push(buffer);
}
}
this._buffer = Buffer.concat(buffers);
this.type = properties.type;
if (/[^\u0020-\u007E]/.test(this.type)) {
this.type = "";
} else {
this.type = this.type.toLowerCase();
}
this.isClosed = false;
}
get size() {
return this.isClosed ? 0 : this._buffer.length;
}
slice(start, end, contentType) {
const size = this.size;
let relativeStart;
let relativeEnd;
let relativeContentType;
if (start === undefined) {
relativeStart = 0;
} else if (start < 0) {
relativeStart = Math.max(size + start, 0);
} else {
relativeStart = Math.min(start, size);
}
if (end === undefined) {
relativeEnd = size;
} else if (end < 0) {
relativeEnd = Math.max(size + end, 0);
} else {
relativeEnd = Math.min(end, size);
}
if (contentType === undefined) {
relativeContentType = "";
} else {
// sanitization (lower case and invalid char check) is done in the
// constructor
relativeContentType = contentType;
}
const span = Math.max(relativeEnd - relativeStart, 0);
const buffer = this._buffer;
const slicedBuffer = buffer.slice(
relativeStart,
relativeStart + span
);
const blob = Blob.createImpl([[], { type: relativeContentType }], {});
blob.isClosed = this.isClosed;
blob._buffer = slicedBuffer;
return blob;
}
close() {
this.isClosed = true;
}
};

View File

@@ -0,0 +1,15 @@
"use strict";
const BlobImpl = require("./Blob-impl").implementation;
exports.implementation = class FileImpl extends BlobImpl {
constructor(args, privateData) {
const fileBits = args[0];
const fileName = args[1];
const options = args[2];
super([fileBits, options], privateData);
this.name = fileName.replace(/\//g, ":");
this.lastModified = "lastModified" in options ? options.lastModified : Date.now();
}
};

View File

@@ -0,0 +1,10 @@
"use strict";
exports.implementation = class FileListImpl extends Array {
constructor() {
super(0);
}
item(index) {
return this[index] || null;
}
};

View File

@@ -0,0 +1,131 @@
"use strict";
const whatwgEncoding = require("whatwg-encoding");
const parseContentType = require("content-type-parser");
const querystring = require("querystring");
const DOMException = require("../../web-idl/DOMException");
const EventTargetImpl = require("../events/EventTarget-impl").implementation;
const Blob = require("../generated/Blob");
const ProgressEvent = require("../generated/ProgressEvent");
const READY_STATES = Object.freeze({
EMPTY: 0,
LOADING: 1,
DONE: 2
});
exports.implementation = class FileReaderImpl extends EventTargetImpl {
constructor(args, privateData) {
super([], privateData);
this.error = null;
this.readyState = READY_STATES.EMPTY;
this.result = null;
this.onloadstart = null;
this.onprogress = null;
this.onload = null;
this.onabort = null;
this.onerror = null;
this.onloadend = null;
this._ownerDocument = privateData.window.document;
}
readAsArrayBuffer(file) {
this._readFile(file, "buffer");
}
readAsDataURL(file) {
this._readFile(file, "dataURL");
}
readAsText(file, encoding) {
this._readFile(file, "text", whatwgEncoding.labelToName(encoding) || "UTF-8");
}
abort() {
if (this.readyState === READY_STATES.DONE || this.readyState === READY_STATES.EMPTY) {
this.result = null;
return;
}
if (this.readyState === READY_STATES.LOADING) {
this.readyState = READY_STATES.DONE;
}
this._fireProgressEvent("abort");
this._fireProgressEvent("loadend");
}
_fireProgressEvent(name, props) {
const event = ProgressEvent.createImpl([name, Object.assign({ bubbles: false, cancelable: false }, props)], {});
this.dispatchEvent(event);
}
_readFile(file, format, encoding) {
if (!Blob.isImpl(file)) {
throw new TypeError("file argument must be a Blob");
}
if (this.readyState === READY_STATES.LOADING) {
throw new DOMException(DOMException.INVALID_STATE_ERR);
}
if (file.isClosed) {
this.error = new DOMException(DOMException.INVALID_STATE_ERR);
this._fireProgressEvent("error");
}
this.readyState = READY_STATES.LOADING;
this._fireProgressEvent("loadstart");
process.nextTick(() => {
let data = file._buffer;
if (!data) {
data = new Buffer("");
}
this._fireProgressEvent("progress", {
lengthComputable: !isNaN(file.size),
total: file.size,
loaded: data.length
});
process.nextTick(() => {
switch (format) {
default:
case "buffer": {
this.result = (new Uint8Array(data)).buffer;
break;
}
case "dataURL": {
let dataUrl = "data:";
const contentType = parseContentType(file.type);
if (contentType && contentType.isText()) {
const fallbackEncoding = whatwgEncoding.getBOMEncoding(data) ||
whatwgEncoding.labelToName(contentType.get("charset")) || "UTF-8";
const decoded = whatwgEncoding.decode(data, fallbackEncoding);
contentType.set("charset", encoding);
dataUrl += contentType.toString();
dataUrl += ",";
dataUrl += querystring.escape(decoded);
} else {
if (contentType) {
dataUrl += contentType.toString();
}
dataUrl += ";base64,";
dataUrl += data.toString("base64");
}
this.result = dataUrl;
break;
}
case "text": {
this.result = whatwgEncoding.decode(data, encoding);
break;
}
}
this.readyState = READY_STATES.DONE;
this._fireProgressEvent("load");
this._fireProgressEvent("loadend");
});
});
}
};

View File

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

View File

@@ -0,0 +1,34 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const EventListenerOptions = require("./EventListenerOptions");
module.exports = {
convertInherit(obj, ret) {
EventListenerOptions.convertInherit(obj, ret);
let key, value;
key = "once";
value = obj === undefined || obj === null ? undefined : obj[key];
if (value !== undefined) {
ret[key] = conversions["boolean"](value);
} else {
ret[key] = false;
}
},
convert(obj) {
if (obj !== undefined && typeof obj !== "object") {
throw new TypeError("Dictionary has to be an object");
}
if (obj instanceof Date || obj instanceof RegExp) {
throw new TypeError("Dictionary may not be a Date or RegExp object");
}
const ret = Object.create(null);
module.exports.convertInherit(obj, ret);
return ret;
}
};

View File

@@ -0,0 +1,169 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const impl = utils.implSymbol;
function Attr() {
throw new TypeError("Illegal constructor");
}
Attr.prototype.toString = function () {
if (this === Attr.prototype) {
return "[object AttrPrototype]";
}
return this[impl].toString();
};
Object.defineProperty(Attr.prototype, "namespaceURI", {
get() {
return this[impl].namespaceURI;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Attr.prototype, "prefix", {
get() {
return this[impl].prefix;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Attr.prototype, "localName", {
get() {
return this[impl].localName;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Attr.prototype, "name", {
get() {
return this[impl].name;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Attr.prototype, "nodeName", {
get() {
return this[impl].nodeName;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Attr.prototype, "value", {
get() {
return this[impl].value;
},
set(V) {
V = conversions["DOMString"](V);
this[impl].value = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Attr.prototype, "nodeValue", {
get() {
return this[impl].nodeValue;
},
set(V) {
V = conversions["DOMString"](V, { treatNullAsEmptyString: true });
this[impl].nodeValue = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Attr.prototype, "textContent", {
get() {
return this[impl].textContent;
},
set(V) {
V = conversions["DOMString"](V, { treatNullAsEmptyString: true });
this[impl].textContent = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Attr.prototype, "ownerElement", {
get() {
return utils.tryWrapperForImpl(this[impl].ownerElement);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Attr.prototype, "specified", {
get() {
return this[impl].specified;
},
enumerable: true,
configurable: true
});
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(Attr.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(Attr.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: Attr,
expose: {
Window: { Attr: Attr }
}
};
module.exports = iface;
const Impl = require("../attributes/Attr-impl.js");

View File

@@ -0,0 +1,140 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const impl = utils.implSymbol;
const convertBlobPropertyBag = require("./BlobPropertyBag").convert;
function Blob() {
const args = [];
for (let i = 0; i < arguments.length && i < 2; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
args[1] = convertBlobPropertyBag(args[1]);
iface.setup(this, args);
}
Blob.prototype.slice = function slice() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const args = [];
for (let i = 0; i < arguments.length && i < 3; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
if (args[0] !== undefined) {
args[0] = conversions["long long"](args[0], { clamp: true });
}
if (args[1] !== undefined) {
args[1] = conversions["long long"](args[1], { clamp: true });
}
if (args[2] !== undefined) {
args[2] = conversions["DOMString"](args[2]);
}
return utils.tryWrapperForImpl(this[impl].slice.apply(this[impl], args));
};
Blob.prototype.close = function close() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const args = [];
for (let i = 0; i < arguments.length && i < 0; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
return this[impl].close.apply(this[impl], args);
};
Blob.prototype.toString = function () {
if (this === Blob.prototype) {
return "[object BlobPrototype]";
}
return this[impl].toString();
};
Object.defineProperty(Blob.prototype, "size", {
get() {
return this[impl].size;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Blob.prototype, "type", {
get() {
return this[impl].type;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Blob.prototype, "isClosed", {
get() {
return this[impl].isClosed;
},
enumerable: true,
configurable: true
});
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(Blob.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(Blob.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: Blob,
expose: {
Window: { Blob: Blob },
Worker: { Blob: Blob }
}
};
module.exports = iface;
const Impl = require("../file-api/Blob-impl.js");

View File

@@ -0,0 +1,32 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
module.exports = {
convertInherit(obj, ret) {
let key, value;
key = "type";
value = obj === undefined || obj === null ? undefined : obj[key];
if (value !== undefined) {
ret[key] = conversions["DOMString"](value);
} else {
ret[key] = "";
}
},
convert(obj) {
if (obj !== undefined && typeof obj !== "object") {
throw new TypeError("Dictionary has to be an object");
}
if (obj instanceof Date || obj instanceof RegExp) {
throw new TypeError("Dictionary may not be a Date or RegExp object");
}
const ret = Object.create(null);
module.exports.convertInherit(obj, ret);
return ret;
}
};

View File

@@ -0,0 +1,82 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const Text = require("./Text.js");
const impl = utils.implSymbol;
function CDATASection() {
throw new TypeError("Illegal constructor");
}
CDATASection.prototype = Object.create(Text.interface.prototype);
CDATASection.prototype.constructor = CDATASection;
CDATASection.prototype.toString = function () {
if (this === CDATASection.prototype) {
return "[object CDATASectionPrototype]";
}
return Text.interface.prototype.toString.call(this);
};
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(CDATASection.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(CDATASection.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
Text._internalSetup(obj);
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: CDATASection,
expose: {
Window: { CDATASection: CDATASection }
}
};
module.exports = iface;
const Impl = require("../nodes/CDATASection-impl.js");

View File

@@ -0,0 +1,189 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const Node = require("./Node.js");
const impl = utils.implSymbol;
const mixin = utils.mixin;
const ChildNode = require("./ChildNode.js");
const NonDocumentTypeChildNode = require("./NonDocumentTypeChildNode.js");
function CharacterData() {
throw new TypeError("Illegal constructor");
}
CharacterData.prototype = Object.create(Node.interface.prototype);
CharacterData.prototype.constructor = CharacterData;
mixin(CharacterData.prototype, ChildNode.interface.prototype);
ChildNode.mixedInto.push(CharacterData);
mixin(CharacterData.prototype, NonDocumentTypeChildNode.interface.prototype);
NonDocumentTypeChildNode.mixedInto.push(CharacterData);
CharacterData.prototype.substringData = function substringData(offset, count) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 2) {
throw new TypeError("Failed to execute 'substringData' on 'CharacterData': 2 arguments required, but only " + arguments.length + " present.");
}
const args = [];
for (let i = 0; i < arguments.length && i < 2; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
args[0] = conversions["unsigned long"](args[0]);
args[1] = conversions["unsigned long"](args[1]);
return this[impl].substringData.apply(this[impl], 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 = [];
for (let i = 0; i < arguments.length && i < 1; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
args[0] = conversions["DOMString"](args[0]);
return this[impl].appendData.apply(this[impl], 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 = [];
for (let i = 0; i < arguments.length && i < 2; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
args[0] = conversions["unsigned long"](args[0]);
args[1] = conversions["DOMString"](args[1]);
return this[impl].insertData.apply(this[impl], 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 = [];
for (let i = 0; i < arguments.length && i < 2; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
args[0] = conversions["unsigned long"](args[0]);
args[1] = conversions["unsigned long"](args[1]);
return this[impl].deleteData.apply(this[impl], 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 = [];
for (let i = 0; i < arguments.length && i < 3; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
args[0] = conversions["unsigned long"](args[0]);
args[1] = conversions["unsigned long"](args[1]);
args[2] = conversions["DOMString"](args[2]);
return this[impl].replaceData.apply(this[impl], args);
};
CharacterData.prototype.toString = function () {
if (this === CharacterData.prototype) {
return "[object CharacterDataPrototype]";
}
return Node.interface.prototype.toString.call(this);
};
Object.defineProperty(CharacterData.prototype, "data", {
get() {
return this[impl].data;
},
set(V) {
V = conversions["DOMString"](V, { treatNullAsEmptyString: true });
this[impl].data = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(CharacterData.prototype, "length", {
get() {
return this[impl].length;
},
enumerable: true,
configurable: true
});
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(CharacterData.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(CharacterData.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
Node._internalSetup(obj);
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: CharacterData,
expose: {
Window: { CharacterData: CharacterData }
}
};
module.exports = iface;
const Impl = require("../nodes/CharacterData-impl.js");

View File

@@ -0,0 +1,92 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const impl = utils.implSymbol;
function ChildNode() {
throw new TypeError("Illegal constructor");
}
ChildNode.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 < 0; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
return this[impl].remove.apply(this[impl], args);
};
ChildNode.prototype.toString = function () {
if (this === ChildNode.prototype) {
return "[object ChildNodePrototype]";
}
return this[impl].toString();
};
ChildNode.prototype[Symbol.unscopables] = {
"remove": true
};
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(ChildNode.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(ChildNode.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: ChildNode,
expose: {
}
};
module.exports = iface;
const Impl = require("../nodes/ChildNode-impl.js");

View File

@@ -0,0 +1,92 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const CharacterData = require("./CharacterData.js");
const impl = utils.implSymbol;
function Comment() {
const args = [];
for (let i = 0; i < arguments.length && i < 1; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
if (args[0] !== undefined) {
args[0] = conversions["DOMString"](args[0]);
} else {
args[0] = "";
}
iface.setup(this, args);
}
Comment.prototype = Object.create(CharacterData.interface.prototype);
Comment.prototype.constructor = Comment;
Comment.prototype.toString = function () {
if (this === Comment.prototype) {
return "[object CommentPrototype]";
}
return CharacterData.interface.prototype.toString.call(this);
};
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(Comment.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(Comment.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
CharacterData._internalSetup(obj);
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: Comment,
expose: {
Window: { Comment: Comment }
}
};
module.exports = iface;
const Impl = require("../nodes/Comment-impl.js");

View File

@@ -0,0 +1,123 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const Event = require("./Event.js");
const impl = utils.implSymbol;
const convertCustomEventInit = require("./CustomEventInit").convert;
function CustomEvent(type) {
if (!this || this[impl] || !(this instanceof CustomEvent)) {
throw new TypeError("Failed to construct 'CustomEvent': Please use the 'new' operator, this DOM object 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 = [];
for (let i = 0; i < arguments.length && i < 2; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
args[0] = conversions["DOMString"](args[0]);
args[1] = convertCustomEventInit(args[1]);
iface.setup(this, args);
}
CustomEvent.prototype = Object.create(Event.interface.prototype);
CustomEvent.prototype.constructor = CustomEvent;
CustomEvent.prototype.initCustomEvent = function initCustomEvent(type, bubbles, cancelable, detail) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 4) {
throw new TypeError("Failed to execute 'initCustomEvent' on 'CustomEvent': 4 arguments required, but only " + arguments.length + " present.");
}
const args = [];
for (let i = 0; i < arguments.length && i < 4; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
args[0] = conversions["DOMString"](args[0]);
args[1] = conversions["boolean"](args[1]);
args[2] = conversions["boolean"](args[2]);
args[3] = conversions["any"](args[3]);
return this[impl].initCustomEvent.apply(this[impl], args);
};
CustomEvent.prototype.toString = function () {
if (this === CustomEvent.prototype) {
return "[object CustomEventPrototype]";
}
return Event.interface.prototype.toString.call(this);
};
Object.defineProperty(CustomEvent.prototype, "detail", {
get() {
return this[impl].detail;
},
enumerable: true,
configurable: true
});
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(CustomEvent.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(CustomEvent.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
Event._internalSetup(obj);
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: CustomEvent,
expose: {
Window: { CustomEvent: CustomEvent },
Worker: { CustomEvent: CustomEvent }
}
};
module.exports = iface;
const Impl = require("../events/CustomEvent-impl.js");

View File

@@ -0,0 +1,34 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const EventInit = require("./EventInit");
module.exports = {
convertInherit(obj, ret) {
EventInit.convertInherit(obj, ret);
let key, value;
key = "detail";
value = obj === undefined || obj === null ? undefined : obj[key];
if (value !== undefined) {
ret[key] = conversions["any"](value);
} else {
ret[key] = null;
}
},
convert(obj) {
if (obj !== undefined && typeof obj !== "object") {
throw new TypeError("Dictionary has to be an object");
}
if (obj instanceof Date || obj instanceof RegExp) {
throw new TypeError("Dictionary may not be a Date or RegExp object");
}
const ret = Object.create(null);
module.exports.convertInherit(obj, ret);
return ret;
}
};

View File

@@ -0,0 +1,143 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const impl = utils.implSymbol;
function DOMImplementation() {
throw new TypeError("Illegal constructor");
}
DOMImplementation.prototype.createDocumentType = function createDocumentType(qualifiedName, publicId, systemId) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 3) {
throw new TypeError("Failed to execute 'createDocumentType' on 'DOMImplementation': 3 arguments required, but only " + arguments.length + " present.");
}
const args = [];
for (let i = 0; i < arguments.length && i < 3; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
args[0] = conversions["DOMString"](args[0]);
args[1] = conversions["DOMString"](args[1]);
args[2] = conversions["DOMString"](args[2]);
return utils.tryWrapperForImpl(this[impl].createDocumentType.apply(this[impl], 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 = [];
for (let i = 0; i < arguments.length && i < 3; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
if (args[0] === null || args[0] === undefined) {
args[0] = null;
} else {
args[0] = conversions["DOMString"](args[0]);
}
args[1] = conversions["DOMString"](args[1], { treatNullAsEmptyString: true });
if (args[2] === null || args[2] === undefined) {
args[2] = null;
} else {
}
return utils.tryWrapperForImpl(this[impl].createDocument.apply(this[impl], args));
};
DOMImplementation.prototype.createHTMLDocument = function createHTMLDocument() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const args = [];
for (let i = 0; i < arguments.length && i < 1; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
if (args[0] !== undefined) {
args[0] = conversions["DOMString"](args[0]);
}
return utils.tryWrapperForImpl(this[impl].createHTMLDocument.apply(this[impl], args));
};
DOMImplementation.prototype.hasFeature = function hasFeature() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const args = [];
for (let i = 0; i < arguments.length && i < 0; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
return this[impl].hasFeature.apply(this[impl], args);
};
DOMImplementation.prototype.toString = function () {
if (this === DOMImplementation.prototype) {
return "[object DOMImplementationPrototype]";
}
return this[impl].toString();
};
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(DOMImplementation.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(DOMImplementation.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: DOMImplementation,
expose: {
Window: { DOMImplementation: DOMImplementation }
}
};
module.exports = iface;
const Impl = require("../nodes/DOMImplementation-impl.js");

View File

@@ -0,0 +1,97 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const impl = utils.implSymbol;
function DOMParser() {
const args = [];
for (let i = 0; i < arguments.length && i < 0; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
iface.setup(this, args);
}
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 = [];
for (let i = 0; i < arguments.length && i < 2; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
args[0] = conversions["DOMString"](args[0]);
return utils.tryWrapperForImpl(this[impl].parseFromString.apply(this[impl], args));
};
DOMParser.prototype.toString = function () {
if (this === DOMParser.prototype) {
return "[object DOMParserPrototype]";
}
return this[impl].toString();
};
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(DOMParser.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(DOMParser.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: DOMParser,
expose: {
Window: { DOMParser: DOMParser }
}
};
module.exports = iface;
const Impl = require("../domparsing/DOMParser-impl.js");

View File

@@ -0,0 +1,751 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const Node = require("./Node.js");
const impl = utils.implSymbol;
const mixin = utils.mixin;
const GlobalEventHandlers = require("./GlobalEventHandlers.js");
const NonElementParentNode = require("./NonElementParentNode.js");
const ParentNode = require("./ParentNode.js");
function Document() {
const args = [];
for (let i = 0; i < arguments.length && i < 0; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
iface.setup(this, args);
}
Document.prototype = Object.create(Node.interface.prototype);
Document.prototype.constructor = Document;
mixin(Document.prototype, GlobalEventHandlers.interface.prototype);
GlobalEventHandlers.mixedInto.push(Document);
mixin(Document.prototype, NonElementParentNode.interface.prototype);
NonElementParentNode.mixedInto.push(Document);
mixin(Document.prototype, ParentNode.interface.prototype);
ParentNode.mixedInto.push(Document);
Document.prototype.getElementsByTagName = function getElementsByTagName(localName) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 1) {
throw new TypeError("Failed to execute 'getElementsByTagName' on 'Document': 1 argument required, but only " + arguments.length + " present.");
}
const args = [];
for (let i = 0; i < arguments.length && i < 1; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
args[0] = conversions["DOMString"](args[0]);
return utils.tryWrapperForImpl(this[impl].getElementsByTagName.apply(this[impl], args));
};
Document.prototype.getElementsByTagNameNS = function getElementsByTagNameNS(namespace, localName) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 2) {
throw new TypeError("Failed to execute 'getElementsByTagNameNS' on 'Document': 2 arguments required, but only " + arguments.length + " present.");
}
const args = [];
for (let i = 0; i < arguments.length && i < 2; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
if (args[0] === null || args[0] === undefined) {
args[0] = null;
} else {
args[0] = conversions["DOMString"](args[0]);
}
args[1] = conversions["DOMString"](args[1]);
return utils.tryWrapperForImpl(this[impl].getElementsByTagNameNS.apply(this[impl], args));
};
Document.prototype.getElementsByClassName = function getElementsByClassName(classNames) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 1) {
throw new TypeError("Failed to execute 'getElementsByClassName' on 'Document': 1 argument required, but only " + arguments.length + " present.");
}
const args = [];
for (let i = 0; i < arguments.length && i < 1; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
args[0] = conversions["DOMString"](args[0]);
return utils.tryWrapperForImpl(this[impl].getElementsByClassName.apply(this[impl], args));
};
Document.prototype.createElement = function createElement(localName) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 1) {
throw new TypeError("Failed to execute 'createElement' on 'Document': 1 argument required, but only " + arguments.length + " present.");
}
const args = [];
for (let i = 0; i < arguments.length && i < 1; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
args[0] = conversions["DOMString"](args[0]);
return utils.tryWrapperForImpl(this[impl].createElement.apply(this[impl], args));
};
Document.prototype.createElementNS = function createElementNS(namespace, qualifiedName) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 2) {
throw new TypeError("Failed to execute 'createElementNS' on 'Document': 2 arguments required, but only " + arguments.length + " present.");
}
const args = [];
for (let i = 0; i < arguments.length && i < 2; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
if (args[0] === null || args[0] === undefined) {
args[0] = null;
} else {
args[0] = conversions["DOMString"](args[0]);
}
args[1] = conversions["DOMString"](args[1]);
return utils.tryWrapperForImpl(this[impl].createElementNS.apply(this[impl], args));
};
Document.prototype.createDocumentFragment = function createDocumentFragment() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const args = [];
for (let i = 0; i < arguments.length && i < 0; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
return utils.tryWrapperForImpl(this[impl].createDocumentFragment.apply(this[impl], args));
};
Document.prototype.createTextNode = function createTextNode(data) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 1) {
throw new TypeError("Failed to execute 'createTextNode' on 'Document': 1 argument required, but only " + arguments.length + " present.");
}
const args = [];
for (let i = 0; i < arguments.length && i < 1; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
args[0] = conversions["DOMString"](args[0]);
return utils.tryWrapperForImpl(this[impl].createTextNode.apply(this[impl], args));
};
Document.prototype.createCDATASection = function createCDATASection(data) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 1) {
throw new TypeError("Failed to execute 'createCDATASection' on 'Document': 1 argument required, but only " + arguments.length + " present.");
}
const args = [];
for (let i = 0; i < arguments.length && i < 1; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
args[0] = conversions["DOMString"](args[0]);
return utils.tryWrapperForImpl(this[impl].createCDATASection.apply(this[impl], args));
};
Document.prototype.createComment = function createComment(data) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 1) {
throw new TypeError("Failed to execute 'createComment' on 'Document': 1 argument required, but only " + arguments.length + " present.");
}
const args = [];
for (let i = 0; i < arguments.length && i < 1; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
args[0] = conversions["DOMString"](args[0]);
return utils.tryWrapperForImpl(this[impl].createComment.apply(this[impl], args));
};
Document.prototype.createProcessingInstruction = function createProcessingInstruction(target, data) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 2) {
throw new TypeError("Failed to execute 'createProcessingInstruction' on 'Document': 2 arguments required, but only " + arguments.length + " present.");
}
const args = [];
for (let i = 0; i < arguments.length && i < 2; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
args[0] = conversions["DOMString"](args[0]);
args[1] = conversions["DOMString"](args[1]);
return utils.tryWrapperForImpl(this[impl].createProcessingInstruction.apply(this[impl], args));
};
Document.prototype.importNode = function importNode(node) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 1) {
throw new TypeError("Failed to execute 'importNode' on 'Document': 1 argument required, but only " + arguments.length + " present.");
}
const args = [];
for (let i = 0; i < arguments.length && i < 2; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
if (args[1] !== undefined) {
args[1] = conversions["boolean"](args[1]);
} else {
args[1] = false;
}
return utils.tryWrapperForImpl(this[impl].importNode.apply(this[impl], args));
};
Document.prototype.adoptNode = function adoptNode(node) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 1) {
throw new TypeError("Failed to execute 'adoptNode' on 'Document': 1 argument required, but only " + arguments.length + " present.");
}
const args = [];
for (let i = 0; i < arguments.length && i < 1; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
return utils.tryWrapperForImpl(this[impl].adoptNode.apply(this[impl], args));
};
Document.prototype.createAttribute = function createAttribute(localName) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 1) {
throw new TypeError("Failed to execute 'createAttribute' on 'Document': 1 argument required, but only " + arguments.length + " present.");
}
const args = [];
for (let i = 0; i < arguments.length && i < 1; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
args[0] = conversions["DOMString"](args[0]);
return utils.tryWrapperForImpl(this[impl].createAttribute.apply(this[impl], args));
};
Document.prototype.createAttributeNS = function createAttributeNS(namespace, qualifiedName) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 2) {
throw new TypeError("Failed to execute 'createAttributeNS' on 'Document': 2 arguments required, but only " + arguments.length + " present.");
}
const args = [];
for (let i = 0; i < arguments.length && i < 2; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
if (args[0] === null || args[0] === undefined) {
args[0] = null;
} else {
args[0] = conversions["DOMString"](args[0]);
}
args[1] = conversions["DOMString"](args[1]);
return utils.tryWrapperForImpl(this[impl].createAttributeNS.apply(this[impl], args));
};
Document.prototype.createEvent = function createEvent(_interface) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 1) {
throw new TypeError("Failed to execute 'createEvent' on 'Document': 1 argument required, but only " + arguments.length + " present.");
}
const args = [];
for (let i = 0; i < arguments.length && i < 1; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
args[0] = conversions["DOMString"](args[0]);
return utils.tryWrapperForImpl(this[impl].createEvent.apply(this[impl], args));
};
Document.prototype.createTreeWalker = function createTreeWalker(root) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 1) {
throw new TypeError("Failed to execute 'createTreeWalker' on 'Document': 1 argument required, but only " + arguments.length + " present.");
}
const args = [];
for (let i = 0; i < arguments.length && i < 3; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
if (args[1] !== undefined) {
args[1] = conversions["unsigned long"](args[1]);
} else {
args[1] = 4294967295;
}
if (args[2] === null || args[2] === undefined) {
args[2] = null;
} else {
}
return utils.tryWrapperForImpl(this[impl].createTreeWalker.apply(this[impl], args));
};
Document.prototype.getElementsByName = function getElementsByName(elementName) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 1) {
throw new TypeError("Failed to execute 'getElementsByName' on 'Document': 1 argument required, but only " + arguments.length + " present.");
}
const args = [];
for (let i = 0; i < arguments.length && i < 1; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
args[0] = conversions["DOMString"](args[0]);
return utils.tryWrapperForImpl(this[impl].getElementsByName.apply(this[impl], args));
};
Document.prototype.open = function open() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const args = [];
for (let i = 0; i < arguments.length && i < 2; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
if (args[0] !== undefined) {
args[0] = conversions["DOMString"](args[0]);
} else {
args[0] = "text/html";
}
if (args[1] !== undefined) {
args[1] = conversions["DOMString"](args[1]);
} else {
args[1] = "";
}
return utils.tryWrapperForImpl(this[impl].open.apply(this[impl], args));
};
Document.prototype.close = function close() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const args = [];
for (let i = 0; i < arguments.length && i < 0; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
return this[impl].close.apply(this[impl], args);
};
Document.prototype.write = function write() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const args = [];
for (let i = 0; i < arguments.length; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
if (args[0] !== undefined) {
args[0] = conversions["DOMString"](args[0]);
}
return this[impl].write.apply(this[impl], args);
};
Document.prototype.writeln = function writeln() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const args = [];
for (let i = 0; i < arguments.length; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
if (args[0] !== undefined) {
args[0] = conversions["DOMString"](args[0]);
}
return this[impl].writeln.apply(this[impl], args);
};
Document.prototype.hasFocus = function hasFocus() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const args = [];
for (let i = 0; i < arguments.length && i < 0; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
return this[impl].hasFocus.apply(this[impl], args);
};
Document.prototype.toString = function () {
if (this === Document.prototype) {
return "[object DocumentPrototype]";
}
return Node.interface.prototype.toString.call(this);
};
Object.defineProperty(Document.prototype, "implementation", {
get() {
return utils.tryWrapperForImpl(this[impl].implementation);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Document.prototype, "URL", {
get() {
return this[impl].URL;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Document.prototype, "documentURI", {
get() {
return this[impl].documentURI;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Document.prototype, "origin", {
get() {
return this[impl].origin;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Document.prototype, "compatMode", {
get() {
return this[impl].compatMode;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Document.prototype, "characterSet", {
get() {
return this[impl].characterSet;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Document.prototype, "charset", {
get() {
return this[impl].charset;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Document.prototype, "inputEncoding", {
get() {
return this[impl].inputEncoding;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Document.prototype, "contentType", {
get() {
return this[impl].contentType;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Document.prototype, "doctype", {
get() {
return utils.tryWrapperForImpl(this[impl].doctype);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Document.prototype, "documentElement", {
get() {
return utils.tryWrapperForImpl(this[impl].documentElement);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Document.prototype, "referrer", {
get() {
return this[impl].referrer;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Document.prototype, "cookie", {
get() {
return this[impl].cookie;
},
set(V) {
V = conversions["DOMString"](V);
this[impl].cookie = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Document.prototype, "lastModified", {
get() {
return this[impl].lastModified;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Document.prototype, "readyState", {
get() {
return utils.tryWrapperForImpl(this[impl].readyState);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Document.prototype, "title", {
get() {
return this[impl].title;
},
set(V) {
V = conversions["DOMString"](V);
this[impl].title = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Document.prototype, "body", {
get() {
return utils.tryWrapperForImpl(this[impl].body);
},
set(V) {
if (V === null || V === undefined) {
V = null;
} else {
}
this[impl].body = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Document.prototype, "head", {
get() {
return utils.tryWrapperForImpl(this[impl].head);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Document.prototype, "images", {
get() {
return utils.tryWrapperForImpl(this[impl].images);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Document.prototype, "embeds", {
get() {
return utils.tryWrapperForImpl(this[impl].embeds);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Document.prototype, "plugins", {
get() {
return utils.tryWrapperForImpl(this[impl].plugins);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Document.prototype, "links", {
get() {
return utils.tryWrapperForImpl(this[impl].links);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Document.prototype, "forms", {
get() {
return utils.tryWrapperForImpl(this[impl].forms);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Document.prototype, "scripts", {
get() {
return utils.tryWrapperForImpl(this[impl].scripts);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Document.prototype, "currentScript", {
get() {
return utils.tryWrapperForImpl(this[impl].currentScript);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Document.prototype, "defaultView", {
get() {
return utils.tryWrapperForImpl(this[impl].defaultView);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Document.prototype, "activeElement", {
get() {
return utils.tryWrapperForImpl(this[impl].activeElement);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Document.prototype, "onreadystatechange", {
get() {
return utils.tryWrapperForImpl(this[impl].onreadystatechange);
},
set(V) {
this[impl].onreadystatechange = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Document.prototype, "anchors", {
get() {
return utils.tryWrapperForImpl(this[impl].anchors);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Document.prototype, "applets", {
get() {
return utils.tryWrapperForImpl(this[impl].applets);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Document.prototype, "styleSheets", {
get() {
return utils.tryWrapperForImpl(this[impl].styleSheets);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Document.prototype, "hidden", {
get() {
return this[impl].hidden;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Document.prototype, "visibilityState", {
get() {
return utils.tryWrapperForImpl(this[impl].visibilityState);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Document.prototype, "onvisibilitychange", {
get() {
return utils.tryWrapperForImpl(this[impl].onvisibilitychange);
},
set(V) {
this[impl].onvisibilitychange = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(Document.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(Document.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
Node._internalSetup(obj);
Object.defineProperty(obj, "location", {
get() {
return utils.tryWrapperForImpl(obj[impl].location);
},
set(V) {
this.location.href = V;
},
enumerable: true,
configurable: false
});
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: Document,
expose: {
Window: { Document: Document }
}
};
module.exports = iface;
const Impl = require("../nodes/Document-impl.js");

View File

@@ -0,0 +1,91 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const Node = require("./Node.js");
const impl = utils.implSymbol;
const mixin = utils.mixin;
const ParentNode = require("./ParentNode.js");
function DocumentFragment() {
const args = [];
for (let i = 0; i < arguments.length && i < 0; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
iface.setup(this, args);
}
DocumentFragment.prototype = Object.create(Node.interface.prototype);
DocumentFragment.prototype.constructor = DocumentFragment;
mixin(DocumentFragment.prototype, ParentNode.interface.prototype);
ParentNode.mixedInto.push(DocumentFragment);
DocumentFragment.prototype.toString = function () {
if (this === DocumentFragment.prototype) {
return "[object DocumentFragmentPrototype]";
}
return Node.interface.prototype.toString.call(this);
};
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(DocumentFragment.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(DocumentFragment.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
Node._internalSetup(obj);
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: DocumentFragment,
expose: {
Window: { DocumentFragment: DocumentFragment }
}
};
module.exports = iface;
const Impl = require("../nodes/DocumentFragment-impl.js");

View File

@@ -0,0 +1,110 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const Node = require("./Node.js");
const impl = utils.implSymbol;
const mixin = utils.mixin;
const ChildNode = require("./ChildNode.js");
function DocumentType() {
throw new TypeError("Illegal constructor");
}
DocumentType.prototype = Object.create(Node.interface.prototype);
DocumentType.prototype.constructor = DocumentType;
mixin(DocumentType.prototype, ChildNode.interface.prototype);
ChildNode.mixedInto.push(DocumentType);
DocumentType.prototype.toString = function () {
if (this === DocumentType.prototype) {
return "[object DocumentTypePrototype]";
}
return Node.interface.prototype.toString.call(this);
};
Object.defineProperty(DocumentType.prototype, "name", {
get() {
return this[impl].name;
},
enumerable: true,
configurable: true
});
Object.defineProperty(DocumentType.prototype, "publicId", {
get() {
return this[impl].publicId;
},
enumerable: true,
configurable: true
});
Object.defineProperty(DocumentType.prototype, "systemId", {
get() {
return this[impl].systemId;
},
enumerable: true,
configurable: true
});
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(DocumentType.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(DocumentType.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
Node._internalSetup(obj);
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: DocumentType,
expose: {
Window: { DocumentType: DocumentType }
}
};
module.exports = iface;
const Impl = require("../nodes/DocumentType-impl.js");

View File

@@ -0,0 +1,624 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const Node = require("./Node.js");
const impl = utils.implSymbol;
const mixin = utils.mixin;
const ChildNode = require("./ChildNode.js");
const NonDocumentTypeChildNode = require("./NonDocumentTypeChildNode.js");
const ParentNode = require("./ParentNode.js");
function Element() {
throw new TypeError("Illegal constructor");
}
Element.prototype = Object.create(Node.interface.prototype);
Element.prototype.constructor = Element;
mixin(Element.prototype, ChildNode.interface.prototype);
ChildNode.mixedInto.push(Element);
mixin(Element.prototype, NonDocumentTypeChildNode.interface.prototype);
NonDocumentTypeChildNode.mixedInto.push(Element);
mixin(Element.prototype, ParentNode.interface.prototype);
ParentNode.mixedInto.push(Element);
Element.prototype.hasAttributes = function hasAttributes() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const args = [];
for (let i = 0; i < arguments.length && i < 0; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
return this[impl].hasAttributes.apply(this[impl], args);
};
Element.prototype.getAttributeNames = function getAttributeNames() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const args = [];
for (let i = 0; i < arguments.length && i < 0; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
return utils.tryWrapperForImpl(this[impl].getAttributeNames.apply(this[impl], args));
};
Element.prototype.getAttribute = function getAttribute(qualifiedName) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 1) {
throw new TypeError("Failed to execute 'getAttribute' on 'Element': 1 argument required, but only " + arguments.length + " present.");
}
const args = [];
for (let i = 0; i < arguments.length && i < 1; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
args[0] = conversions["DOMString"](args[0]);
return this[impl].getAttribute.apply(this[impl], args);
};
Element.prototype.getAttributeNS = function getAttributeNS(namespace, localName) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 2) {
throw new TypeError("Failed to execute 'getAttributeNS' on 'Element': 2 arguments required, but only " + arguments.length + " present.");
}
const args = [];
for (let i = 0; i < arguments.length && i < 2; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
if (args[0] === null || args[0] === undefined) {
args[0] = null;
} else {
args[0] = conversions["DOMString"](args[0]);
}
args[1] = conversions["DOMString"](args[1]);
return this[impl].getAttributeNS.apply(this[impl], args);
};
Element.prototype.setAttribute = function setAttribute(qualifiedName, value) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 2) {
throw new TypeError("Failed to execute 'setAttribute' on 'Element': 2 arguments required, but only " + arguments.length + " present.");
}
const args = [];
for (let i = 0; i < arguments.length && i < 2; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
args[0] = conversions["DOMString"](args[0]);
args[1] = conversions["DOMString"](args[1]);
return this[impl].setAttribute.apply(this[impl], args);
};
Element.prototype.setAttributeNS = function setAttributeNS(namespace, qualifiedName, value) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 3) {
throw new TypeError("Failed to execute 'setAttributeNS' on 'Element': 3 arguments required, but only " + arguments.length + " present.");
}
const args = [];
for (let i = 0; i < arguments.length && i < 3; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
if (args[0] === null || args[0] === undefined) {
args[0] = null;
} else {
args[0] = conversions["DOMString"](args[0]);
}
args[1] = conversions["DOMString"](args[1]);
args[2] = conversions["DOMString"](args[2]);
return this[impl].setAttributeNS.apply(this[impl], args);
};
Element.prototype.removeAttribute = function removeAttribute(qualifiedName) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 1) {
throw new TypeError("Failed to execute 'removeAttribute' on 'Element': 1 argument required, but only " + arguments.length + " present.");
}
const args = [];
for (let i = 0; i < arguments.length && i < 1; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
args[0] = conversions["DOMString"](args[0]);
return this[impl].removeAttribute.apply(this[impl], args);
};
Element.prototype.removeAttributeNS = function removeAttributeNS(namespace, localName) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 2) {
throw new TypeError("Failed to execute 'removeAttributeNS' on 'Element': 2 arguments required, but only " + arguments.length + " present.");
}
const args = [];
for (let i = 0; i < arguments.length && i < 2; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
if (args[0] === null || args[0] === undefined) {
args[0] = null;
} else {
args[0] = conversions["DOMString"](args[0]);
}
args[1] = conversions["DOMString"](args[1]);
return this[impl].removeAttributeNS.apply(this[impl], args);
};
Element.prototype.hasAttribute = function hasAttribute(qualifiedName) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 1) {
throw new TypeError("Failed to execute 'hasAttribute' on 'Element': 1 argument required, but only " + arguments.length + " present.");
}
const args = [];
for (let i = 0; i < arguments.length && i < 1; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
args[0] = conversions["DOMString"](args[0]);
return this[impl].hasAttribute.apply(this[impl], args);
};
Element.prototype.hasAttributeNS = function hasAttributeNS(namespace, localName) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 2) {
throw new TypeError("Failed to execute 'hasAttributeNS' on 'Element': 2 arguments required, but only " + arguments.length + " present.");
}
const args = [];
for (let i = 0; i < arguments.length && i < 2; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
if (args[0] === null || args[0] === undefined) {
args[0] = null;
} else {
args[0] = conversions["DOMString"](args[0]);
}
args[1] = conversions["DOMString"](args[1]);
return this[impl].hasAttributeNS.apply(this[impl], args);
};
Element.prototype.getAttributeNode = function getAttributeNode(qualifiedName) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 1) {
throw new TypeError("Failed to execute 'getAttributeNode' on 'Element': 1 argument required, but only " + arguments.length + " present.");
}
const args = [];
for (let i = 0; i < arguments.length && i < 1; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
args[0] = conversions["DOMString"](args[0]);
return utils.tryWrapperForImpl(this[impl].getAttributeNode.apply(this[impl], args));
};
Element.prototype.getAttributeNodeNS = function getAttributeNodeNS(namespace, localName) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 2) {
throw new TypeError("Failed to execute 'getAttributeNodeNS' on 'Element': 2 arguments required, but only " + arguments.length + " present.");
}
const args = [];
for (let i = 0; i < arguments.length && i < 2; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
if (args[0] === null || args[0] === undefined) {
args[0] = null;
} else {
args[0] = conversions["DOMString"](args[0]);
}
args[1] = conversions["DOMString"](args[1]);
return utils.tryWrapperForImpl(this[impl].getAttributeNodeNS.apply(this[impl], args));
};
Element.prototype.setAttributeNode = function setAttributeNode(attr) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 1) {
throw new TypeError("Failed to execute 'setAttributeNode' on 'Element': 1 argument required, but only " + arguments.length + " present.");
}
const args = [];
for (let i = 0; i < arguments.length && i < 1; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
return utils.tryWrapperForImpl(this[impl].setAttributeNode.apply(this[impl], args));
};
Element.prototype.setAttributeNodeNS = function setAttributeNodeNS(attr) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 1) {
throw new TypeError("Failed to execute 'setAttributeNodeNS' on 'Element': 1 argument required, but only " + arguments.length + " present.");
}
const args = [];
for (let i = 0; i < arguments.length && i < 1; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
return utils.tryWrapperForImpl(this[impl].setAttributeNodeNS.apply(this[impl], args));
};
Element.prototype.removeAttributeNode = function removeAttributeNode(attr) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 1) {
throw new TypeError("Failed to execute 'removeAttributeNode' on 'Element': 1 argument required, but only " + arguments.length + " present.");
}
const args = [];
for (let i = 0; i < arguments.length && i < 1; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
return utils.tryWrapperForImpl(this[impl].removeAttributeNode.apply(this[impl], args));
};
Element.prototype.matches = function matches(selectors) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 1) {
throw new TypeError("Failed to execute 'matches' on 'Element': 1 argument required, but only " + arguments.length + " present.");
}
const args = [];
for (let i = 0; i < arguments.length && i < 1; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
args[0] = conversions["DOMString"](args[0]);
return this[impl].matches.apply(this[impl], args);
};
Element.prototype.webkitMatchesSelector = function webkitMatchesSelector(selectors) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 1) {
throw new TypeError("Failed to execute 'webkitMatchesSelector' on 'Element': 1 argument required, but only " + arguments.length + " present.");
}
const args = [];
for (let i = 0; i < arguments.length && i < 1; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
args[0] = conversions["DOMString"](args[0]);
return this[impl].webkitMatchesSelector.apply(this[impl], args);
};
Element.prototype.getElementsByTagName = function getElementsByTagName(localName) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 1) {
throw new TypeError("Failed to execute 'getElementsByTagName' on 'Element': 1 argument required, but only " + arguments.length + " present.");
}
const args = [];
for (let i = 0; i < arguments.length && i < 1; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
args[0] = conversions["DOMString"](args[0]);
return utils.tryWrapperForImpl(this[impl].getElementsByTagName.apply(this[impl], args));
};
Element.prototype.getElementsByTagNameNS = function getElementsByTagNameNS(namespace, localName) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 2) {
throw new TypeError("Failed to execute 'getElementsByTagNameNS' on 'Element': 2 arguments required, but only " + arguments.length + " present.");
}
const args = [];
for (let i = 0; i < arguments.length && i < 2; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
if (args[0] === null || args[0] === undefined) {
args[0] = null;
} else {
args[0] = conversions["DOMString"](args[0]);
}
args[1] = conversions["DOMString"](args[1]);
return utils.tryWrapperForImpl(this[impl].getElementsByTagNameNS.apply(this[impl], args));
};
Element.prototype.getElementsByClassName = function getElementsByClassName(classNames) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 1) {
throw new TypeError("Failed to execute 'getElementsByClassName' on 'Element': 1 argument required, but only " + arguments.length + " present.");
}
const args = [];
for (let i = 0; i < arguments.length && i < 1; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
args[0] = conversions["DOMString"](args[0]);
return utils.tryWrapperForImpl(this[impl].getElementsByClassName.apply(this[impl], args));
};
Element.prototype.insertAdjacentHTML = function insertAdjacentHTML(position, text) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 2) {
throw new TypeError("Failed to execute 'insertAdjacentHTML' on 'Element': 2 arguments required, but only " + arguments.length + " present.");
}
const args = [];
for (let i = 0; i < arguments.length && i < 2; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
args[0] = conversions["DOMString"](args[0]);
args[1] = conversions["DOMString"](args[1]);
return this[impl].insertAdjacentHTML.apply(this[impl], args);
};
Element.prototype.getClientRects = function getClientRects() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const args = [];
for (let i = 0; i < arguments.length && i < 0; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
return utils.tryWrapperForImpl(this[impl].getClientRects.apply(this[impl], args));
};
Element.prototype.getBoundingClientRect = function getBoundingClientRect() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const args = [];
for (let i = 0; i < arguments.length && i < 0; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
return utils.tryWrapperForImpl(this[impl].getBoundingClientRect.apply(this[impl], args));
};
Element.prototype.toString = function () {
if (this === Element.prototype) {
return "[object ElementPrototype]";
}
return Node.interface.prototype.toString.call(this);
};
Object.defineProperty(Element.prototype, "namespaceURI", {
get() {
return this[impl].namespaceURI;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Element.prototype, "prefix", {
get() {
return this[impl].prefix;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Element.prototype, "localName", {
get() {
return this[impl].localName;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Element.prototype, "tagName", {
get() {
return this[impl].tagName;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Element.prototype, "id", {
get() {
const value = this.getAttribute("id");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("id", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Element.prototype, "className", {
get() {
const value = this.getAttribute("class");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("class", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Element.prototype, "classList", {
get() {
return utils.tryWrapperForImpl(this[impl].classList);
},
set(V) {
this.classList.value = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Element.prototype, "attributes", {
get() {
return utils.tryWrapperForImpl(this[impl].attributes);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Element.prototype, "innerHTML", {
get() {
return this[impl].innerHTML;
},
set(V) {
V = conversions["DOMString"](V, { treatNullAsEmptyString: true });
this[impl].innerHTML = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Element.prototype, "outerHTML", {
get() {
return this[impl].outerHTML;
},
set(V) {
V = conversions["DOMString"](V, { treatNullAsEmptyString: true });
this[impl].outerHTML = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Element.prototype, "scrollTop", {
get() {
return this[impl].scrollTop;
},
set(V) {
V = conversions["unrestricted double"](V);
this[impl].scrollTop = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Element.prototype, "scrollLeft", {
get() {
return this[impl].scrollLeft;
},
set(V) {
V = conversions["unrestricted double"](V);
this[impl].scrollLeft = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Element.prototype, "scrollWidth", {
get() {
return this[impl].scrollWidth;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Element.prototype, "scrollHeight", {
get() {
return this[impl].scrollHeight;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Element.prototype, "clientTop", {
get() {
return this[impl].clientTop;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Element.prototype, "clientLeft", {
get() {
return this[impl].clientLeft;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Element.prototype, "clientWidth", {
get() {
return this[impl].clientWidth;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Element.prototype, "clientHeight", {
get() {
return this[impl].clientHeight;
},
enumerable: true,
configurable: true
});
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(Element.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(Element.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
Node._internalSetup(obj);
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: Element,
expose: {
Window: { Element: Element }
}
};
module.exports = iface;
const Impl = require("../nodes/Element-impl.js");

View File

@@ -0,0 +1,88 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const impl = utils.implSymbol;
function ElementCSSInlineStyle() {
throw new TypeError("Illegal constructor");
}
ElementCSSInlineStyle.prototype.toString = function () {
if (this === ElementCSSInlineStyle.prototype) {
return "[object ElementCSSInlineStylePrototype]";
}
return this[impl].toString();
};
Object.defineProperty(ElementCSSInlineStyle.prototype, "style", {
get() {
return utils.tryWrapperForImpl(this[impl].style);
},
set(V) {
this.style.cssText = V;
},
enumerable: true,
configurable: true
});
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(ElementCSSInlineStyle.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(ElementCSSInlineStyle.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: ElementCSSInlineStyle,
expose: {
}
};
module.exports = iface;
const Impl = require("../nodes/ElementCSSInlineStyle-impl.js");

View File

@@ -0,0 +1,77 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const impl = utils.implSymbol;
function ElementContentEditable() {
throw new TypeError("Illegal constructor");
}
ElementContentEditable.prototype.toString = function () {
if (this === ElementContentEditable.prototype) {
return "[object ElementContentEditablePrototype]";
}
return this[impl].toString();
};
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(ElementContentEditable.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(ElementContentEditable.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: ElementContentEditable,
expose: {
}
};
module.exports = iface;
const Impl = require("../nodes/ElementContentEditable-impl.js");

View File

@@ -0,0 +1,137 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const Event = require("./Event.js");
const impl = utils.implSymbol;
const convertErrorEventInit = require("./ErrorEventInit").convert;
function ErrorEvent(type) {
if (!this || this[impl] || !(this instanceof ErrorEvent)) {
throw new TypeError("Failed to construct 'ErrorEvent': Please use the 'new' operator, this DOM object constructor cannot be called as a function.");
}
if (arguments.length < 1) {
throw new TypeError("Failed to construct 'ErrorEvent': 1 argument required, but only " + arguments.length + " present.");
}
const args = [];
for (let i = 0; i < arguments.length && i < 2; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
args[0] = conversions["DOMString"](args[0]);
args[1] = convertErrorEventInit(args[1]);
iface.setup(this, args);
}
ErrorEvent.prototype = Object.create(Event.interface.prototype);
ErrorEvent.prototype.constructor = ErrorEvent;
ErrorEvent.prototype.toString = function () {
if (this === ErrorEvent.prototype) {
return "[object ErrorEventPrototype]";
}
return Event.interface.prototype.toString.call(this);
};
Object.defineProperty(ErrorEvent.prototype, "message", {
get() {
return this[impl].message;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ErrorEvent.prototype, "filename", {
get() {
return this[impl].filename;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ErrorEvent.prototype, "lineno", {
get() {
return this[impl].lineno;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ErrorEvent.prototype, "colno", {
get() {
return this[impl].colno;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ErrorEvent.prototype, "error", {
get() {
return this[impl].error;
},
enumerable: true,
configurable: true
});
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(ErrorEvent.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(ErrorEvent.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
Event._internalSetup(obj);
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: ErrorEvent,
expose: {
Window: { ErrorEvent: ErrorEvent },
Worker: { ErrorEvent: ErrorEvent }
}
};
module.exports = iface;
const Impl = require("../events/ErrorEvent-impl.js");

View File

@@ -0,0 +1,56 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const EventInit = require("./EventInit");
module.exports = {
convertInherit(obj, ret) {
EventInit.convertInherit(obj, ret);
let key, value;
key = "colno";
value = obj === undefined || obj === null ? undefined : obj[key];
if (value !== undefined) {
ret[key] = conversions["unsigned long"](value);
}
key = "error";
value = obj === undefined || obj === null ? undefined : obj[key];
if (value !== undefined) {
ret[key] = conversions["any"](value);
}
key = "filename";
value = obj === undefined || obj === null ? undefined : obj[key];
if (value !== undefined) {
ret[key] = conversions["DOMString"](value);
}
key = "lineno";
value = obj === undefined || obj === null ? undefined : obj[key];
if (value !== undefined) {
ret[key] = conversions["unsigned long"](value);
}
key = "message";
value = obj === undefined || obj === null ? undefined : obj[key];
if (value !== undefined) {
ret[key] = conversions["DOMString"](value);
}
},
convert(obj) {
if (obj !== undefined && typeof obj !== "object") {
throw new TypeError("Dictionary has to be an object");
}
if (obj instanceof Date || obj instanceof RegExp) {
throw new TypeError("Dictionary may not be a Date or RegExp object");
}
const ret = Object.create(null);
module.exports.convertInherit(obj, ret);
return ret;
}
};

View File

@@ -0,0 +1,263 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const impl = utils.implSymbol;
const convertEventInit = require("./EventInit").convert;
function Event(type) {
if (!this || this[impl] || !(this instanceof Event)) {
throw new TypeError("Failed to construct 'Event': Please use the 'new' operator, this DOM object 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 = [];
for (let i = 0; i < arguments.length && i < 2; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
args[0] = conversions["DOMString"](args[0]);
args[1] = convertEventInit(args[1]);
iface.setup(this, args);
}
Event.prototype.stopPropagation = function stopPropagation() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const args = [];
for (let i = 0; i < arguments.length && i < 0; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
return this[impl].stopPropagation.apply(this[impl], args);
};
Event.prototype.stopImmediatePropagation = function stopImmediatePropagation() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const args = [];
for (let i = 0; i < arguments.length && i < 0; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
return this[impl].stopImmediatePropagation.apply(this[impl], args);
};
Event.prototype.preventDefault = function preventDefault() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const args = [];
for (let i = 0; i < arguments.length && i < 0; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
return this[impl].preventDefault.apply(this[impl], args);
};
Event.prototype.initEvent = function initEvent(type, bubbles, cancelable) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 3) {
throw new TypeError("Failed to execute 'initEvent' on 'Event': 3 arguments required, but only " + arguments.length + " present.");
}
const args = [];
for (let i = 0; i < arguments.length && i < 3; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
args[0] = conversions["DOMString"](args[0]);
args[1] = conversions["boolean"](args[1]);
args[2] = conversions["boolean"](args[2]);
return this[impl].initEvent.apply(this[impl], args);
};
Event.prototype.toString = function () {
if (this === Event.prototype) {
return "[object EventPrototype]";
}
return this[impl].toString();
};
Object.defineProperty(Event.prototype, "type", {
get() {
return this[impl].type;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Event.prototype, "target", {
get() {
return utils.tryWrapperForImpl(this[impl].target);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Event.prototype, "currentTarget", {
get() {
return utils.tryWrapperForImpl(this[impl].currentTarget);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Event, "NONE", {
value: 0,
enumerable: true
});
Object.defineProperty(Event.prototype, "NONE", {
value: 0,
enumerable: true
});
Object.defineProperty(Event, "CAPTURING_PHASE", {
value: 1,
enumerable: true
});
Object.defineProperty(Event.prototype, "CAPTURING_PHASE", {
value: 1,
enumerable: true
});
Object.defineProperty(Event, "AT_TARGET", {
value: 2,
enumerable: true
});
Object.defineProperty(Event.prototype, "AT_TARGET", {
value: 2,
enumerable: true
});
Object.defineProperty(Event, "BUBBLING_PHASE", {
value: 3,
enumerable: true
});
Object.defineProperty(Event.prototype, "BUBBLING_PHASE", {
value: 3,
enumerable: true
});
Object.defineProperty(Event.prototype, "eventPhase", {
get() {
return this[impl].eventPhase;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Event.prototype, "cancelBubble", {
get() {
return this[impl].cancelBubble;
},
set(V) {
V = conversions["boolean"](V);
this[impl].cancelBubble = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Event.prototype, "bubbles", {
get() {
return this[impl].bubbles;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Event.prototype, "cancelable", {
get() {
return this[impl].cancelable;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Event.prototype, "defaultPrevented", {
get() {
return this[impl].defaultPrevented;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Event.prototype, "timeStamp", {
get() {
return this[impl].timeStamp;
},
enumerable: true,
configurable: true
});
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(Event.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(Event.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
Object.defineProperty(obj, "isTrusted", {
get() {
return obj[impl].isTrusted;
},
enumerable: true,
configurable: false
});
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: Event,
expose: {
Window: { Event: Event },
Worker: { Event: Event }
}
};
module.exports = iface;
const Impl = require("../events/Event-impl.js");

View File

@@ -0,0 +1,40 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
module.exports = {
convertInherit(obj, ret) {
let key, value;
key = "bubbles";
value = obj === undefined || obj === null ? undefined : obj[key];
if (value !== undefined) {
ret[key] = conversions["boolean"](value);
} else {
ret[key] = false;
}
key = "cancelable";
value = obj === undefined || obj === null ? undefined : obj[key];
if (value !== undefined) {
ret[key] = conversions["boolean"](value);
} else {
ret[key] = false;
}
},
convert(obj) {
if (obj !== undefined && typeof obj !== "object") {
throw new TypeError("Dictionary has to be an object");
}
if (obj instanceof Date || obj instanceof RegExp) {
throw new TypeError("Dictionary may not be a Date or RegExp object");
}
const ret = Object.create(null);
module.exports.convertInherit(obj, ret);
return ret;
}
};

View File

@@ -0,0 +1,32 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
module.exports = {
convertInherit(obj, ret) {
let key, value;
key = "capture";
value = obj === undefined || obj === null ? undefined : obj[key];
if (value !== undefined) {
ret[key] = conversions["boolean"](value);
} else {
ret[key] = false;
}
},
convert(obj) {
if (obj !== undefined && typeof obj !== "object") {
throw new TypeError("Dictionary has to be an object");
}
if (obj instanceof Date || obj instanceof RegExp) {
throw new TypeError("Dictionary may not be a Date or RegExp object");
}
const ret = Object.create(null);
module.exports.convertInherit(obj, ret);
return ret;
}
};

View File

@@ -0,0 +1,146 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const UIEventInit = require("./UIEventInit");
module.exports = {
convertInherit(obj, ret) {
UIEventInit.convertInherit(obj, ret);
let key, value;
key = "altKey";
value = obj === undefined || obj === null ? undefined : obj[key];
if (value !== undefined) {
ret[key] = conversions["boolean"](value);
} else {
ret[key] = false;
}
key = "ctrlKey";
value = obj === undefined || obj === null ? undefined : obj[key];
if (value !== undefined) {
ret[key] = conversions["boolean"](value);
} else {
ret[key] = false;
}
key = "metaKey";
value = obj === undefined || obj === null ? undefined : obj[key];
if (value !== undefined) {
ret[key] = conversions["boolean"](value);
} else {
ret[key] = false;
}
key = "modifierAltGraph";
value = obj === undefined || obj === null ? undefined : obj[key];
if (value !== undefined) {
ret[key] = conversions["boolean"](value);
} else {
ret[key] = false;
}
key = "modifierCapsLock";
value = obj === undefined || obj === null ? undefined : obj[key];
if (value !== undefined) {
ret[key] = conversions["boolean"](value);
} else {
ret[key] = false;
}
key = "modifierFn";
value = obj === undefined || obj === null ? undefined : obj[key];
if (value !== undefined) {
ret[key] = conversions["boolean"](value);
} else {
ret[key] = false;
}
key = "modifierFnLock";
value = obj === undefined || obj === null ? undefined : obj[key];
if (value !== undefined) {
ret[key] = conversions["boolean"](value);
} else {
ret[key] = false;
}
key = "modifierHyper";
value = obj === undefined || obj === null ? undefined : obj[key];
if (value !== undefined) {
ret[key] = conversions["boolean"](value);
} else {
ret[key] = false;
}
key = "modifierNumLock";
value = obj === undefined || obj === null ? undefined : obj[key];
if (value !== undefined) {
ret[key] = conversions["boolean"](value);
} else {
ret[key] = false;
}
key = "modifierOS";
value = obj === undefined || obj === null ? undefined : obj[key];
if (value !== undefined) {
ret[key] = conversions["boolean"](value);
} else {
ret[key] = false;
}
key = "modifierScrollLock";
value = obj === undefined || obj === null ? undefined : obj[key];
if (value !== undefined) {
ret[key] = conversions["boolean"](value);
} else {
ret[key] = false;
}
key = "modifierSuper";
value = obj === undefined || obj === null ? undefined : obj[key];
if (value !== undefined) {
ret[key] = conversions["boolean"](value);
} else {
ret[key] = false;
}
key = "modifierSymbol";
value = obj === undefined || obj === null ? undefined : obj[key];
if (value !== undefined) {
ret[key] = conversions["boolean"](value);
} else {
ret[key] = false;
}
key = "modifierSymbolLock";
value = obj === undefined || obj === null ? undefined : obj[key];
if (value !== undefined) {
ret[key] = conversions["boolean"](value);
} else {
ret[key] = false;
}
key = "shiftKey";
value = obj === undefined || obj === null ? undefined : obj[key];
if (value !== undefined) {
ret[key] = conversions["boolean"](value);
} else {
ret[key] = false;
}
},
convert(obj) {
if (obj !== undefined && typeof obj !== "object") {
throw new TypeError("Dictionary has to be an object");
}
if (obj instanceof Date || obj instanceof RegExp) {
throw new TypeError("Dictionary may not be a Date or RegExp object");
}
const ret = Object.create(null);
module.exports.convertInherit(obj, ret);
return ret;
}
};

View File

@@ -0,0 +1,130 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const impl = utils.implSymbol;
function EventTarget() {
throw new TypeError("Illegal constructor");
}
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 = [];
for (let i = 0; i < arguments.length && i < 3; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
args[0] = conversions["DOMString"](args[0]);
if (args[1] === null || args[1] === undefined) {
args[1] = null;
} else {
}
return this[impl].addEventListener.apply(this[impl], 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 = [];
for (let i = 0; i < arguments.length && i < 3; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
args[0] = conversions["DOMString"](args[0]);
if (args[1] === null || args[1] === undefined) {
args[1] = null;
} else {
}
return this[impl].removeEventListener.apply(this[impl], 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 = [];
for (let i = 0; i < arguments.length && i < 1; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
return this[impl].dispatchEvent.apply(this[impl], args);
};
EventTarget.prototype.toString = function () {
if (this === EventTarget.prototype) {
return "[object EventTargetPrototype]";
}
return this[impl].toString();
};
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(EventTarget.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(EventTarget.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: EventTarget,
expose: {
Window: { EventTarget: EventTarget },
Worker: { EventTarget: EventTarget }
}
};
module.exports = iface;
const Impl = require("../events/EventTarget-impl.js");

View File

@@ -0,0 +1,113 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const Blob = require("./Blob.js");
const impl = utils.implSymbol;
const convertFilePropertyBag = require("./FilePropertyBag").convert;
function File(fileBits, fileName) {
if (!this || this[impl] || !(this instanceof File)) {
throw new TypeError("Failed to construct 'File': Please use the 'new' operator, this DOM object 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 = [];
for (let i = 0; i < arguments.length && i < 3; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
args[1] = conversions["USVString"](args[1]);
args[2] = convertFilePropertyBag(args[2]);
iface.setup(this, args);
}
File.prototype = Object.create(Blob.interface.prototype);
File.prototype.constructor = File;
File.prototype.toString = function () {
if (this === File.prototype) {
return "[object FilePrototype]";
}
return Blob.interface.prototype.toString.call(this);
};
Object.defineProperty(File.prototype, "name", {
get() {
return this[impl].name;
},
enumerable: true,
configurable: true
});
Object.defineProperty(File.prototype, "lastModified", {
get() {
return this[impl].lastModified;
},
enumerable: true,
configurable: true
});
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(File.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(File.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
Blob._internalSetup(obj);
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: File,
expose: {
Window: { File: File },
Worker: { File: File }
}
};
module.exports = iface;
const Impl = require("../file-api/File-impl.js");

View File

@@ -0,0 +1,101 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const impl = utils.implSymbol;
function FileList() {
throw new TypeError("Illegal constructor");
}
FileList.prototype.item = function item(index) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 1) {
throw new TypeError("Failed to execute 'item' on 'FileList': 1 argument required, but only " + arguments.length + " present.");
}
const args = [];
for (let i = 0; i < arguments.length && i < 1; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
args[0] = conversions["unsigned long"](args[0]);
return utils.tryWrapperForImpl(this[impl].item.apply(this[impl], args));
};
FileList.prototype.toString = function () {
if (this === FileList.prototype) {
return "[object FileListPrototype]";
}
return this[impl].toString();
};
Object.defineProperty(FileList.prototype, "length", {
get() {
return this[impl].length;
},
enumerable: true,
configurable: true
});
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(FileList.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(FileList.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: FileList,
expose: {
Window: { FileList: FileList },
Worker: { FileList: FileList }
}
};
module.exports = iface;
const Impl = require("../file-api/FileList-impl.js");

View File

@@ -0,0 +1,32 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const BlobPropertyBag = require("./BlobPropertyBag");
module.exports = {
convertInherit(obj, ret) {
BlobPropertyBag.convertInherit(obj, ret);
let key, value;
key = "lastModified";
value = obj === undefined || obj === null ? undefined : obj[key];
if (value !== undefined) {
ret[key] = conversions["long long"](value);
}
},
convert(obj) {
if (obj !== undefined && typeof obj !== "object") {
throw new TypeError("Dictionary has to be an object");
}
if (obj instanceof Date || obj instanceof RegExp) {
throw new TypeError("Dictionary may not be a Date or RegExp object");
}
const ret = Object.create(null);
module.exports.convertInherit(obj, ret);
return ret;
}
};

View File

@@ -0,0 +1,273 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const EventTarget = require("./EventTarget.js");
const impl = utils.implSymbol;
module.exports = {
createInterface: function (defaultPrivateData) {
defaultPrivateData = defaultPrivateData === undefined ? {} : defaultPrivateData;
function FileReader() {
const args = [];
for (let i = 0; i < arguments.length && i < 0; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
iface.setup(this, args);
}
FileReader.prototype = Object.create(EventTarget.interface.prototype);
FileReader.prototype.constructor = FileReader;
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 = [];
for (let i = 0; i < arguments.length && i < 1; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
return this[impl].readAsArrayBuffer.apply(this[impl], 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 = [];
for (let i = 0; i < arguments.length && i < 2; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
if (args[1] !== undefined) {
args[1] = conversions["DOMString"](args[1]);
}
return this[impl].readAsText.apply(this[impl], args);
};
FileReader.prototype.readAsDataURL = function readAsDataURL(blob) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 1) {
throw new TypeError("Failed to execute 'readAsDataURL' on 'FileReader': 1 argument required, but only " + arguments.length + " present.");
}
const args = [];
for (let i = 0; i < arguments.length && i < 1; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
return this[impl].readAsDataURL.apply(this[impl], args);
};
FileReader.prototype.abort = function abort() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const args = [];
for (let i = 0; i < arguments.length && i < 0; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
return this[impl].abort.apply(this[impl], args);
};
FileReader.prototype.toString = function () {
if (this === FileReader.prototype) {
return "[object FileReaderPrototype]";
}
return EventTarget.interface.prototype.toString.call(this);
};
Object.defineProperty(FileReader, "EMPTY", {
value: 0,
enumerable: true
});
Object.defineProperty(FileReader.prototype, "EMPTY", {
value: 0,
enumerable: true
});
Object.defineProperty(FileReader, "LOADING", {
value: 1,
enumerable: true
});
Object.defineProperty(FileReader.prototype, "LOADING", {
value: 1,
enumerable: true
});
Object.defineProperty(FileReader, "DONE", {
value: 2,
enumerable: true
});
Object.defineProperty(FileReader.prototype, "DONE", {
value: 2,
enumerable: true
});
Object.defineProperty(FileReader.prototype, "readyState", {
get() {
return this[impl].readyState;
},
enumerable: true,
configurable: true
});
Object.defineProperty(FileReader.prototype, "result", {
get() {
return utils.tryWrapperForImpl(this[impl].result);
},
enumerable: true,
configurable: true
});
Object.defineProperty(FileReader.prototype, "error", {
get() {
return utils.tryWrapperForImpl(this[impl].error);
},
enumerable: true,
configurable: true
});
Object.defineProperty(FileReader.prototype, "onloadstart", {
get() {
return utils.tryWrapperForImpl(this[impl].onloadstart);
},
set(V) {
this[impl].onloadstart = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(FileReader.prototype, "onprogress", {
get() {
return utils.tryWrapperForImpl(this[impl].onprogress);
},
set(V) {
this[impl].onprogress = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(FileReader.prototype, "onload", {
get() {
return utils.tryWrapperForImpl(this[impl].onload);
},
set(V) {
this[impl].onload = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(FileReader.prototype, "onabort", {
get() {
return utils.tryWrapperForImpl(this[impl].onabort);
},
set(V) {
this[impl].onabort = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(FileReader.prototype, "onerror", {
get() {
return utils.tryWrapperForImpl(this[impl].onerror);
},
set(V) {
this[impl].onerror = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(FileReader.prototype, "onloadend", {
get() {
return utils.tryWrapperForImpl(this[impl].onloadend);
},
set(V) {
this[impl].onloadend = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
const iface = {
create(constructorArgs, privateData) {
let obj = Object.create(FileReader.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(FileReader.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
EventTarget._internalSetup(obj);
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
for (var prop in defaultPrivateData) {
if (!(prop in privateData)) {
privateData[prop] = defaultPrivateData[prop];
}
}
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: FileReader,
expose: {
Window: { FileReader: FileReader },
Worker: { FileReader: FileReader }
}
};
return iface;
},
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
};
const Impl = require("../file-api/FileReader-impl.js");

View File

@@ -0,0 +1,104 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const UIEvent = require("./UIEvent.js");
const impl = utils.implSymbol;
const convertFocusEventInit = require("./FocusEventInit").convert;
function FocusEvent(type) {
if (!this || this[impl] || !(this instanceof FocusEvent)) {
throw new TypeError("Failed to construct 'FocusEvent': Please use the 'new' operator, this DOM object constructor cannot be called as a function.");
}
if (arguments.length < 1) {
throw new TypeError("Failed to construct 'FocusEvent': 1 argument required, but only " + arguments.length + " present.");
}
const args = [];
for (let i = 0; i < arguments.length && i < 2; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
args[0] = conversions["DOMString"](args[0]);
args[1] = convertFocusEventInit(args[1]);
iface.setup(this, args);
}
FocusEvent.prototype = Object.create(UIEvent.interface.prototype);
FocusEvent.prototype.constructor = FocusEvent;
FocusEvent.prototype.toString = function () {
if (this === FocusEvent.prototype) {
return "[object FocusEventPrototype]";
}
return UIEvent.interface.prototype.toString.call(this);
};
Object.defineProperty(FocusEvent.prototype, "relatedTarget", {
get() {
return utils.tryWrapperForImpl(this[impl].relatedTarget);
},
enumerable: true,
configurable: true
});
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(FocusEvent.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(FocusEvent.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
UIEvent._internalSetup(obj);
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: FocusEvent,
expose: {
Window: { FocusEvent: FocusEvent }
}
};
module.exports = iface;
const Impl = require("../events/FocusEvent-impl.js");

View File

@@ -0,0 +1,34 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const UIEventInit = require("./UIEventInit");
module.exports = {
convertInherit(obj, ret) {
UIEventInit.convertInherit(obj, ret);
let key, value;
key = "relatedTarget";
value = obj === undefined || obj === null ? undefined : obj[key];
if (value !== undefined) {
ret[key] = (value);
} else {
ret[key] = null;
}
},
convert(obj) {
if (obj !== undefined && typeof obj !== "object") {
throw new TypeError("Dictionary has to be an object");
}
if (obj instanceof Date || obj instanceof RegExp) {
throw new TypeError("Dictionary may not be a Date or RegExp object");
}
const ret = Object.create(null);
module.exports.convertInherit(obj, ret);
return ret;
}
};

View File

@@ -0,0 +1,179 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const impl = utils.implSymbol;
function FormData() {
const args = [];
for (let i = 0; i < arguments.length && i < 1; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
iface.setup(this, args);
}
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 = [];
for (let i = 0; i < arguments.length && i < 3; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
args[0] = conversions["USVString"](args[0]);
if (args[2] !== undefined) {
args[2] = conversions["USVString"](args[2]);
}
return this[impl].append.apply(this[impl], args);
};
FormData.prototype.delete = function _(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 = [];
for (let i = 0; i < arguments.length && i < 1; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
args[0] = conversions["USVString"](args[0]);
return this[impl].delete.apply(this[impl], 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 = [];
for (let i = 0; i < arguments.length && i < 1; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
args[0] = conversions["USVString"](args[0]);
return utils.tryWrapperForImpl(this[impl].get.apply(this[impl], 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 = [];
for (let i = 0; i < arguments.length && i < 1; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
args[0] = conversions["USVString"](args[0]);
return utils.tryWrapperForImpl(this[impl].getAll.apply(this[impl], 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 = [];
for (let i = 0; i < arguments.length && i < 1; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
args[0] = conversions["USVString"](args[0]);
return this[impl].has.apply(this[impl], 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 = [];
for (let i = 0; i < arguments.length && i < 3; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
args[0] = conversions["USVString"](args[0]);
if (args[2] !== undefined) {
args[2] = conversions["USVString"](args[2]);
}
return this[impl].set.apply(this[impl], args);
};
FormData.prototype.toString = function () {
if (this === FormData.prototype) {
return "[object FormDataPrototype]";
}
return this[impl].toString();
};
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(FormData.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(FormData.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: FormData,
expose: {
Window: { FormData: FormData },
Worker: { FormData: FormData }
}
};
module.exports = iface;
const Impl = require("../xhr/FormData-impl.js");

View File

@@ -0,0 +1,770 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const impl = utils.implSymbol;
function GlobalEventHandlers() {
throw new TypeError("Illegal constructor");
}
GlobalEventHandlers.prototype.toString = function () {
if (this === GlobalEventHandlers.prototype) {
return "[object GlobalEventHandlersPrototype]";
}
return this[impl].toString();
};
Object.defineProperty(GlobalEventHandlers.prototype, "onabort", {
get() {
return utils.tryWrapperForImpl(this[impl].onabort);
},
set(V) {
this[impl].onabort = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "onautocomplete", {
get() {
return utils.tryWrapperForImpl(this[impl].onautocomplete);
},
set(V) {
this[impl].onautocomplete = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "onautocompleteerror", {
get() {
return utils.tryWrapperForImpl(this[impl].onautocompleteerror);
},
set(V) {
this[impl].onautocompleteerror = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "onblur", {
get() {
return utils.tryWrapperForImpl(this[impl].onblur);
},
set(V) {
this[impl].onblur = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "oncancel", {
get() {
return utils.tryWrapperForImpl(this[impl].oncancel);
},
set(V) {
this[impl].oncancel = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "oncanplay", {
get() {
return utils.tryWrapperForImpl(this[impl].oncanplay);
},
set(V) {
this[impl].oncanplay = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "oncanplaythrough", {
get() {
return utils.tryWrapperForImpl(this[impl].oncanplaythrough);
},
set(V) {
this[impl].oncanplaythrough = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "onchange", {
get() {
return utils.tryWrapperForImpl(this[impl].onchange);
},
set(V) {
this[impl].onchange = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "onclick", {
get() {
return utils.tryWrapperForImpl(this[impl].onclick);
},
set(V) {
this[impl].onclick = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "onclose", {
get() {
return utils.tryWrapperForImpl(this[impl].onclose);
},
set(V) {
this[impl].onclose = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "oncontextmenu", {
get() {
return utils.tryWrapperForImpl(this[impl].oncontextmenu);
},
set(V) {
this[impl].oncontextmenu = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "oncuechange", {
get() {
return utils.tryWrapperForImpl(this[impl].oncuechange);
},
set(V) {
this[impl].oncuechange = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "ondblclick", {
get() {
return utils.tryWrapperForImpl(this[impl].ondblclick);
},
set(V) {
this[impl].ondblclick = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "ondrag", {
get() {
return utils.tryWrapperForImpl(this[impl].ondrag);
},
set(V) {
this[impl].ondrag = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "ondragend", {
get() {
return utils.tryWrapperForImpl(this[impl].ondragend);
},
set(V) {
this[impl].ondragend = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "ondragenter", {
get() {
return utils.tryWrapperForImpl(this[impl].ondragenter);
},
set(V) {
this[impl].ondragenter = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "ondragexit", {
get() {
return utils.tryWrapperForImpl(this[impl].ondragexit);
},
set(V) {
this[impl].ondragexit = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "ondragleave", {
get() {
return utils.tryWrapperForImpl(this[impl].ondragleave);
},
set(V) {
this[impl].ondragleave = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "ondragover", {
get() {
return utils.tryWrapperForImpl(this[impl].ondragover);
},
set(V) {
this[impl].ondragover = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "ondragstart", {
get() {
return utils.tryWrapperForImpl(this[impl].ondragstart);
},
set(V) {
this[impl].ondragstart = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "ondrop", {
get() {
return utils.tryWrapperForImpl(this[impl].ondrop);
},
set(V) {
this[impl].ondrop = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "ondurationchange", {
get() {
return utils.tryWrapperForImpl(this[impl].ondurationchange);
},
set(V) {
this[impl].ondurationchange = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "onemptied", {
get() {
return utils.tryWrapperForImpl(this[impl].onemptied);
},
set(V) {
this[impl].onemptied = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "onended", {
get() {
return utils.tryWrapperForImpl(this[impl].onended);
},
set(V) {
this[impl].onended = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "onerror", {
get() {
return utils.tryWrapperForImpl(this[impl].onerror);
},
set(V) {
this[impl].onerror = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "onfocus", {
get() {
return utils.tryWrapperForImpl(this[impl].onfocus);
},
set(V) {
this[impl].onfocus = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "oninput", {
get() {
return utils.tryWrapperForImpl(this[impl].oninput);
},
set(V) {
this[impl].oninput = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "oninvalid", {
get() {
return utils.tryWrapperForImpl(this[impl].oninvalid);
},
set(V) {
this[impl].oninvalid = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "onkeydown", {
get() {
return utils.tryWrapperForImpl(this[impl].onkeydown);
},
set(V) {
this[impl].onkeydown = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "onkeypress", {
get() {
return utils.tryWrapperForImpl(this[impl].onkeypress);
},
set(V) {
this[impl].onkeypress = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "onkeyup", {
get() {
return utils.tryWrapperForImpl(this[impl].onkeyup);
},
set(V) {
this[impl].onkeyup = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "onload", {
get() {
return utils.tryWrapperForImpl(this[impl].onload);
},
set(V) {
this[impl].onload = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "onloadeddata", {
get() {
return utils.tryWrapperForImpl(this[impl].onloadeddata);
},
set(V) {
this[impl].onloadeddata = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "onloadedmetadata", {
get() {
return utils.tryWrapperForImpl(this[impl].onloadedmetadata);
},
set(V) {
this[impl].onloadedmetadata = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "onloadstart", {
get() {
return utils.tryWrapperForImpl(this[impl].onloadstart);
},
set(V) {
this[impl].onloadstart = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "onmousedown", {
get() {
return utils.tryWrapperForImpl(this[impl].onmousedown);
},
set(V) {
this[impl].onmousedown = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "onmouseenter", {
get() {
return utils.tryWrapperForImpl(this[impl].onmouseenter);
},
set(V) {
this[impl].onmouseenter = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "onmouseleave", {
get() {
return utils.tryWrapperForImpl(this[impl].onmouseleave);
},
set(V) {
this[impl].onmouseleave = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "onmousemove", {
get() {
return utils.tryWrapperForImpl(this[impl].onmousemove);
},
set(V) {
this[impl].onmousemove = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "onmouseout", {
get() {
return utils.tryWrapperForImpl(this[impl].onmouseout);
},
set(V) {
this[impl].onmouseout = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "onmouseover", {
get() {
return utils.tryWrapperForImpl(this[impl].onmouseover);
},
set(V) {
this[impl].onmouseover = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "onmouseup", {
get() {
return utils.tryWrapperForImpl(this[impl].onmouseup);
},
set(V) {
this[impl].onmouseup = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "onwheel", {
get() {
return utils.tryWrapperForImpl(this[impl].onwheel);
},
set(V) {
this[impl].onwheel = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "onpause", {
get() {
return utils.tryWrapperForImpl(this[impl].onpause);
},
set(V) {
this[impl].onpause = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "onplay", {
get() {
return utils.tryWrapperForImpl(this[impl].onplay);
},
set(V) {
this[impl].onplay = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "onplaying", {
get() {
return utils.tryWrapperForImpl(this[impl].onplaying);
},
set(V) {
this[impl].onplaying = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "onprogress", {
get() {
return utils.tryWrapperForImpl(this[impl].onprogress);
},
set(V) {
this[impl].onprogress = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "onratechange", {
get() {
return utils.tryWrapperForImpl(this[impl].onratechange);
},
set(V) {
this[impl].onratechange = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "onreset", {
get() {
return utils.tryWrapperForImpl(this[impl].onreset);
},
set(V) {
this[impl].onreset = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "onresize", {
get() {
return utils.tryWrapperForImpl(this[impl].onresize);
},
set(V) {
this[impl].onresize = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "onscroll", {
get() {
return utils.tryWrapperForImpl(this[impl].onscroll);
},
set(V) {
this[impl].onscroll = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "onseeked", {
get() {
return utils.tryWrapperForImpl(this[impl].onseeked);
},
set(V) {
this[impl].onseeked = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "onseeking", {
get() {
return utils.tryWrapperForImpl(this[impl].onseeking);
},
set(V) {
this[impl].onseeking = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "onselect", {
get() {
return utils.tryWrapperForImpl(this[impl].onselect);
},
set(V) {
this[impl].onselect = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "onshow", {
get() {
return utils.tryWrapperForImpl(this[impl].onshow);
},
set(V) {
this[impl].onshow = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "onsort", {
get() {
return utils.tryWrapperForImpl(this[impl].onsort);
},
set(V) {
this[impl].onsort = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "onstalled", {
get() {
return utils.tryWrapperForImpl(this[impl].onstalled);
},
set(V) {
this[impl].onstalled = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "onsubmit", {
get() {
return utils.tryWrapperForImpl(this[impl].onsubmit);
},
set(V) {
this[impl].onsubmit = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "onsuspend", {
get() {
return utils.tryWrapperForImpl(this[impl].onsuspend);
},
set(V) {
this[impl].onsuspend = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "ontimeupdate", {
get() {
return utils.tryWrapperForImpl(this[impl].ontimeupdate);
},
set(V) {
this[impl].ontimeupdate = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "ontoggle", {
get() {
return utils.tryWrapperForImpl(this[impl].ontoggle);
},
set(V) {
this[impl].ontoggle = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "onvolumechange", {
get() {
return utils.tryWrapperForImpl(this[impl].onvolumechange);
},
set(V) {
this[impl].onvolumechange = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(GlobalEventHandlers.prototype, "onwaiting", {
get() {
return utils.tryWrapperForImpl(this[impl].onwaiting);
},
set(V) {
this[impl].onwaiting = utils.tryImplForWrapper(V);
},
enumerable: true,
configurable: true
});
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(GlobalEventHandlers.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(GlobalEventHandlers.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: GlobalEventHandlers,
expose: {
}
};
module.exports = iface;
const Impl = require("../nodes/GlobalEventHandlers-impl.js");

View File

@@ -0,0 +1,228 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const HTMLElement = require("./HTMLElement.js");
const impl = utils.implSymbol;
const mixin = utils.mixin;
const HTMLHyperlinkElementUtils = require("./HTMLHyperlinkElementUtils.js");
function HTMLAnchorElement() {
throw new TypeError("Illegal constructor");
}
HTMLAnchorElement.prototype = Object.create(HTMLElement.interface.prototype);
HTMLAnchorElement.prototype.constructor = HTMLAnchorElement;
mixin(HTMLAnchorElement.prototype, HTMLHyperlinkElementUtils.interface.prototype);
HTMLHyperlinkElementUtils.mixedInto.push(HTMLAnchorElement);
HTMLAnchorElement.prototype.toString = function () {
if (this === HTMLAnchorElement.prototype) {
return "[object HTMLAnchorElementPrototype]";
}
return HTMLElement.interface.prototype.toString.call(this);
};
Object.defineProperty(HTMLAnchorElement.prototype, "target", {
get() {
const value = this.getAttribute("target");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("target", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAnchorElement.prototype, "download", {
get() {
const value = this.getAttribute("download");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("download", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAnchorElement.prototype, "rel", {
get() {
const value = this.getAttribute("rel");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("rel", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAnchorElement.prototype, "hreflang", {
get() {
const value = this.getAttribute("hreflang");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("hreflang", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAnchorElement.prototype, "type", {
get() {
const value = this.getAttribute("type");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("type", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAnchorElement.prototype, "text", {
get() {
return this[impl].text;
},
set(V) {
V = conversions["DOMString"](V);
this[impl].text = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAnchorElement.prototype, "coords", {
get() {
const value = this.getAttribute("coords");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("coords", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAnchorElement.prototype, "charset", {
get() {
const value = this.getAttribute("charset");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("charset", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAnchorElement.prototype, "name", {
get() {
const value = this.getAttribute("name");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("name", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAnchorElement.prototype, "rev", {
get() {
const value = this.getAttribute("rev");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("rev", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAnchorElement.prototype, "shape", {
get() {
const value = this.getAttribute("shape");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("shape", V);
},
enumerable: true,
configurable: true
});
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(HTMLAnchorElement.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(HTMLAnchorElement.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
HTMLElement._internalSetup(obj);
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: HTMLAnchorElement,
expose: {
Window: { HTMLAnchorElement: HTMLAnchorElement }
}
};
module.exports = iface;
const Impl = require("../nodes/HTMLAnchorElement-impl.js");

View File

@@ -0,0 +1,225 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const HTMLElement = require("./HTMLElement.js");
const impl = utils.implSymbol;
function HTMLAppletElement() {
throw new TypeError("Illegal constructor");
}
HTMLAppletElement.prototype = Object.create(HTMLElement.interface.prototype);
HTMLAppletElement.prototype.constructor = HTMLAppletElement;
HTMLAppletElement.prototype.toString = function () {
if (this === HTMLAppletElement.prototype) {
return "[object HTMLAppletElementPrototype]";
}
return HTMLElement.interface.prototype.toString.call(this);
};
Object.defineProperty(HTMLAppletElement.prototype, "align", {
get() {
const value = this.getAttribute("align");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("align", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAppletElement.prototype, "alt", {
get() {
const value = this.getAttribute("alt");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("alt", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAppletElement.prototype, "archive", {
get() {
const value = this.getAttribute("archive");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("archive", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAppletElement.prototype, "code", {
get() {
const value = this.getAttribute("code");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("code", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAppletElement.prototype, "codeBase", {
get() {
return this[impl].codeBase;
},
set(V) {
V = conversions["DOMString"](V);
this[impl].codeBase = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAppletElement.prototype, "height", {
get() {
const value = this.getAttribute("height");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("height", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAppletElement.prototype, "hspace", {
get() {
const value = parseInt(this.getAttribute("hspace"));
return isNaN(value) || value < 0 || value > 2147483647 ? 0 : value
},
set(V) {
V = conversions["unsigned long"](V);
V = V > 2147483647 ? 0 : V;
this.setAttribute("hspace", String(V));
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAppletElement.prototype, "name", {
get() {
const value = this.getAttribute("name");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("name", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAppletElement.prototype, "object", {
get() {
return this[impl].object;
},
set(V) {
V = conversions["DOMString"](V);
this[impl].object = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAppletElement.prototype, "vspace", {
get() {
const value = parseInt(this.getAttribute("vspace"));
return isNaN(value) || value < 0 || value > 2147483647 ? 0 : value
},
set(V) {
V = conversions["unsigned long"](V);
V = V > 2147483647 ? 0 : V;
this.setAttribute("vspace", String(V));
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAppletElement.prototype, "width", {
get() {
const value = this.getAttribute("width");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("width", V);
},
enumerable: true,
configurable: true
});
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(HTMLAppletElement.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(HTMLAppletElement.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
HTMLElement._internalSetup(obj);
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: HTMLAppletElement,
expose: {
Window: { HTMLAppletElement: HTMLAppletElement }
}
};
module.exports = iface;
const Impl = require("../nodes/HTMLAppletElement-impl.js");

View File

@@ -0,0 +1,167 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const HTMLElement = require("./HTMLElement.js");
const impl = utils.implSymbol;
const mixin = utils.mixin;
const HTMLHyperlinkElementUtils = require("./HTMLHyperlinkElementUtils.js");
function HTMLAreaElement() {
throw new TypeError("Illegal constructor");
}
HTMLAreaElement.prototype = Object.create(HTMLElement.interface.prototype);
HTMLAreaElement.prototype.constructor = HTMLAreaElement;
mixin(HTMLAreaElement.prototype, HTMLHyperlinkElementUtils.interface.prototype);
HTMLHyperlinkElementUtils.mixedInto.push(HTMLAreaElement);
HTMLAreaElement.prototype.toString = function () {
if (this === HTMLAreaElement.prototype) {
return "[object HTMLAreaElementPrototype]";
}
return HTMLElement.interface.prototype.toString.call(this);
};
Object.defineProperty(HTMLAreaElement.prototype, "alt", {
get() {
const value = this.getAttribute("alt");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("alt", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAreaElement.prototype, "coords", {
get() {
const value = this.getAttribute("coords");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("coords", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAreaElement.prototype, "shape", {
get() {
const value = this.getAttribute("shape");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("shape", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAreaElement.prototype, "target", {
get() {
const value = this.getAttribute("target");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("target", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAreaElement.prototype, "rel", {
get() {
const value = this.getAttribute("rel");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("rel", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLAreaElement.prototype, "noHref", {
get() {
return this.hasAttribute("noHref");
},
set(V) {
V = conversions["boolean"](V);
if (V) {
this.setAttribute("noHref", "");
} else {
this.removeAttribute("noHref");
}
},
enumerable: true,
configurable: true
});
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(HTMLAreaElement.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(HTMLAreaElement.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
HTMLElement._internalSetup(obj);
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: HTMLAreaElement,
expose: {
Window: { HTMLAreaElement: HTMLAreaElement }
}
};
module.exports = iface;
const Impl = require("../nodes/HTMLAreaElement-impl.js");

View File

@@ -0,0 +1,82 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const HTMLMediaElement = require("./HTMLMediaElement.js");
const impl = utils.implSymbol;
function HTMLAudioElement() {
throw new TypeError("Illegal constructor");
}
HTMLAudioElement.prototype = Object.create(HTMLMediaElement.interface.prototype);
HTMLAudioElement.prototype.constructor = HTMLAudioElement;
HTMLAudioElement.prototype.toString = function () {
if (this === HTMLAudioElement.prototype) {
return "[object HTMLAudioElementPrototype]";
}
return HTMLMediaElement.interface.prototype.toString.call(this);
};
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(HTMLAudioElement.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(HTMLAudioElement.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
HTMLMediaElement._internalSetup(obj);
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: HTMLAudioElement,
expose: {
Window: { HTMLAudioElement: HTMLAudioElement }
}
};
module.exports = iface;
const Impl = require("../nodes/HTMLAudioElement-impl.js");

View File

@@ -0,0 +1,95 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const HTMLElement = require("./HTMLElement.js");
const impl = utils.implSymbol;
function HTMLBRElement() {
throw new TypeError("Illegal constructor");
}
HTMLBRElement.prototype = Object.create(HTMLElement.interface.prototype);
HTMLBRElement.prototype.constructor = HTMLBRElement;
HTMLBRElement.prototype.toString = function () {
if (this === HTMLBRElement.prototype) {
return "[object HTMLBRElementPrototype]";
}
return HTMLElement.interface.prototype.toString.call(this);
};
Object.defineProperty(HTMLBRElement.prototype, "clear", {
get() {
const value = this.getAttribute("clear");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("clear", V);
},
enumerable: true,
configurable: true
});
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(HTMLBRElement.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(HTMLBRElement.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
HTMLElement._internalSetup(obj);
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: HTMLBRElement,
expose: {
Window: { HTMLBRElement: HTMLBRElement }
}
};
module.exports = iface;
const Impl = require("../nodes/HTMLBRElement-impl.js");

View File

@@ -0,0 +1,107 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const HTMLElement = require("./HTMLElement.js");
const impl = utils.implSymbol;
function HTMLBaseElement() {
throw new TypeError("Illegal constructor");
}
HTMLBaseElement.prototype = Object.create(HTMLElement.interface.prototype);
HTMLBaseElement.prototype.constructor = HTMLBaseElement;
HTMLBaseElement.prototype.toString = function () {
if (this === HTMLBaseElement.prototype) {
return "[object HTMLBaseElementPrototype]";
}
return HTMLElement.interface.prototype.toString.call(this);
};
Object.defineProperty(HTMLBaseElement.prototype, "href", {
get() {
return this[impl].href;
},
set(V) {
V = conversions["DOMString"](V);
this[impl].href = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLBaseElement.prototype, "target", {
get() {
const value = this.getAttribute("target");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("target", V);
},
enumerable: true,
configurable: true
});
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(HTMLBaseElement.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(HTMLBaseElement.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
HTMLElement._internalSetup(obj);
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: HTMLBaseElement,
expose: {
Window: { HTMLBaseElement: HTMLBaseElement }
}
};
module.exports = iface;
const Impl = require("../nodes/HTMLBaseElement-impl.js");

View File

@@ -0,0 +1,164 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const HTMLElement = require("./HTMLElement.js");
const impl = utils.implSymbol;
const mixin = utils.mixin;
const WindowEventHandlers = require("./WindowEventHandlers.js");
function HTMLBodyElement() {
throw new TypeError("Illegal constructor");
}
HTMLBodyElement.prototype = Object.create(HTMLElement.interface.prototype);
HTMLBodyElement.prototype.constructor = HTMLBodyElement;
mixin(HTMLBodyElement.prototype, WindowEventHandlers.interface.prototype);
WindowEventHandlers.mixedInto.push(HTMLBodyElement);
HTMLBodyElement.prototype.toString = function () {
if (this === HTMLBodyElement.prototype) {
return "[object HTMLBodyElementPrototype]";
}
return HTMLElement.interface.prototype.toString.call(this);
};
Object.defineProperty(HTMLBodyElement.prototype, "text", {
get() {
const value = this.getAttribute("text");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V, { treatNullAsEmptyString: true });
this.setAttribute("text", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLBodyElement.prototype, "link", {
get() {
const value = this.getAttribute("link");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V, { treatNullAsEmptyString: true });
this.setAttribute("link", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLBodyElement.prototype, "vLink", {
get() {
const value = this.getAttribute("vLink");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V, { treatNullAsEmptyString: true });
this.setAttribute("vLink", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLBodyElement.prototype, "aLink", {
get() {
const value = this.getAttribute("aLink");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V, { treatNullAsEmptyString: true });
this.setAttribute("aLink", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLBodyElement.prototype, "bgColor", {
get() {
const value = this.getAttribute("bgColor");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V, { treatNullAsEmptyString: true });
this.setAttribute("bgColor", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLBodyElement.prototype, "background", {
get() {
const value = this.getAttribute("background");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("background", V);
},
enumerable: true,
configurable: true
});
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(HTMLBodyElement.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(HTMLBodyElement.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
HTMLElement._internalSetup(obj);
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: HTMLBodyElement,
expose: {
Window: { HTMLBodyElement: HTMLBodyElement }
}
};
module.exports = iface;
const Impl = require("../nodes/HTMLBodyElement-impl.js");

View File

@@ -0,0 +1,189 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const HTMLElement = require("./HTMLElement.js");
const impl = utils.implSymbol;
function HTMLButtonElement() {
throw new TypeError("Illegal constructor");
}
HTMLButtonElement.prototype = Object.create(HTMLElement.interface.prototype);
HTMLButtonElement.prototype.constructor = HTMLButtonElement;
HTMLButtonElement.prototype.toString = function () {
if (this === HTMLButtonElement.prototype) {
return "[object HTMLButtonElementPrototype]";
}
return HTMLElement.interface.prototype.toString.call(this);
};
Object.defineProperty(HTMLButtonElement.prototype, "autofocus", {
get() {
return this.hasAttribute("autofocus");
},
set(V) {
V = conversions["boolean"](V);
if (V) {
this.setAttribute("autofocus", "");
} else {
this.removeAttribute("autofocus");
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLButtonElement.prototype, "disabled", {
get() {
return this.hasAttribute("disabled");
},
set(V) {
V = conversions["boolean"](V);
if (V) {
this.setAttribute("disabled", "");
} else {
this.removeAttribute("disabled");
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLButtonElement.prototype, "form", {
get() {
return utils.tryWrapperForImpl(this[impl].form);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLButtonElement.prototype, "formNoValidate", {
get() {
return this.hasAttribute("formNoValidate");
},
set(V) {
V = conversions["boolean"](V);
if (V) {
this.setAttribute("formNoValidate", "");
} else {
this.removeAttribute("formNoValidate");
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLButtonElement.prototype, "formTarget", {
get() {
const value = this.getAttribute("formTarget");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("formTarget", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLButtonElement.prototype, "name", {
get() {
const value = this.getAttribute("name");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("name", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLButtonElement.prototype, "type", {
get() {
return this[impl].type;
},
set(V) {
V = conversions["DOMString"](V);
this[impl].type = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLButtonElement.prototype, "value", {
get() {
const value = this.getAttribute("value");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("value", V);
},
enumerable: true,
configurable: true
});
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(HTMLButtonElement.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(HTMLButtonElement.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
HTMLElement._internalSetup(obj);
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: HTMLButtonElement,
expose: {
Window: { HTMLButtonElement: HTMLButtonElement }
}
};
module.exports = iface;
const Impl = require("../nodes/HTMLButtonElement-impl.js");

View File

@@ -0,0 +1,193 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const HTMLElement = require("./HTMLElement.js");
const impl = utils.implSymbol;
function HTMLCanvasElement() {
throw new TypeError("Illegal constructor");
}
HTMLCanvasElement.prototype = Object.create(HTMLElement.interface.prototype);
HTMLCanvasElement.prototype.constructor = HTMLCanvasElement;
HTMLCanvasElement.prototype.getContext = function getContext(contextId) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 1) {
throw new TypeError("Failed to execute 'getContext' on 'HTMLCanvasElement': 1 argument required, but only " + arguments.length + " present.");
}
const args = [];
for (let i = 0; i < arguments.length; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
args[0] = conversions["DOMString"](args[0]);
if (args[1] !== undefined) {
args[1] = conversions["any"](args[1]);
}
return utils.tryWrapperForImpl(this[impl].getContext.apply(this[impl], args));
};
HTMLCanvasElement.prototype.probablySupportsContext = function probablySupportsContext(contextId) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 1) {
throw new TypeError("Failed to execute 'probablySupportsContext' on 'HTMLCanvasElement': 1 argument required, but only " + arguments.length + " present.");
}
const args = [];
for (let i = 0; i < arguments.length; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
args[0] = conversions["DOMString"](args[0]);
if (args[1] !== undefined) {
args[1] = conversions["any"](args[1]);
}
return this[impl].probablySupportsContext.apply(this[impl], args);
};
HTMLCanvasElement.prototype.setContext = function setContext(context) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 1) {
throw new TypeError("Failed to execute 'setContext' on 'HTMLCanvasElement': 1 argument required, but only " + arguments.length + " present.");
}
const args = [];
for (let i = 0; i < arguments.length && i < 1; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
return this[impl].setContext.apply(this[impl], args);
};
HTMLCanvasElement.prototype.toDataURL = function toDataURL() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const args = [];
for (let i = 0; i < arguments.length; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
if (args[0] !== undefined) {
args[0] = conversions["DOMString"](args[0]);
}
if (args[1] !== undefined) {
args[1] = conversions["any"](args[1]);
}
return this[impl].toDataURL.apply(this[impl], args);
};
HTMLCanvasElement.prototype.toBlob = function toBlob(callback) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 1) {
throw new TypeError("Failed to execute 'toBlob' on 'HTMLCanvasElement': 1 argument required, but only " + arguments.length + " present.");
}
const args = [];
for (let i = 0; i < arguments.length; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
if (args[1] !== undefined) {
args[1] = conversions["DOMString"](args[1]);
}
if (args[2] !== undefined) {
args[2] = conversions["any"](args[2]);
}
return this[impl].toBlob.apply(this[impl], args);
};
HTMLCanvasElement.prototype.toString = function () {
if (this === HTMLCanvasElement.prototype) {
return "[object HTMLCanvasElementPrototype]";
}
return HTMLElement.interface.prototype.toString.call(this);
};
Object.defineProperty(HTMLCanvasElement.prototype, "width", {
get() {
return this[impl].width;
},
set(V) {
V = conversions["unsigned long"](V);
this[impl].width = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLCanvasElement.prototype, "height", {
get() {
return this[impl].height;
},
set(V) {
V = conversions["unsigned long"](V);
this[impl].height = V;
},
enumerable: true,
configurable: true
});
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(HTMLCanvasElement.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(HTMLCanvasElement.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
HTMLElement._internalSetup(obj);
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: HTMLCanvasElement,
expose: {
Window: { HTMLCanvasElement: HTMLCanvasElement }
}
};
module.exports = iface;
const Impl = require("../nodes/HTMLCanvasElement-impl.js");

View File

@@ -0,0 +1,98 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const HTMLElement = require("./HTMLElement.js");
const impl = utils.implSymbol;
function HTMLDListElement() {
throw new TypeError("Illegal constructor");
}
HTMLDListElement.prototype = Object.create(HTMLElement.interface.prototype);
HTMLDListElement.prototype.constructor = HTMLDListElement;
HTMLDListElement.prototype.toString = function () {
if (this === HTMLDListElement.prototype) {
return "[object HTMLDListElementPrototype]";
}
return HTMLElement.interface.prototype.toString.call(this);
};
Object.defineProperty(HTMLDListElement.prototype, "compact", {
get() {
return this.hasAttribute("compact");
},
set(V) {
V = conversions["boolean"](V);
if (V) {
this.setAttribute("compact", "");
} else {
this.removeAttribute("compact");
}
},
enumerable: true,
configurable: true
});
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(HTMLDListElement.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(HTMLDListElement.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
HTMLElement._internalSetup(obj);
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: HTMLDListElement,
expose: {
Window: { HTMLDListElement: HTMLDListElement }
}
};
module.exports = iface;
const Impl = require("../nodes/HTMLDListElement-impl.js");

View File

@@ -0,0 +1,95 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const HTMLElement = require("./HTMLElement.js");
const impl = utils.implSymbol;
function HTMLDataElement() {
throw new TypeError("Illegal constructor");
}
HTMLDataElement.prototype = Object.create(HTMLElement.interface.prototype);
HTMLDataElement.prototype.constructor = HTMLDataElement;
HTMLDataElement.prototype.toString = function () {
if (this === HTMLDataElement.prototype) {
return "[object HTMLDataElementPrototype]";
}
return HTMLElement.interface.prototype.toString.call(this);
};
Object.defineProperty(HTMLDataElement.prototype, "value", {
get() {
const value = this.getAttribute("value");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("value", V);
},
enumerable: true,
configurable: true
});
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(HTMLDataElement.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(HTMLDataElement.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
HTMLElement._internalSetup(obj);
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: HTMLDataElement,
expose: {
Window: { HTMLDataElement: HTMLDataElement }
}
};
module.exports = iface;
const Impl = require("../nodes/HTMLDataElement-impl.js");

View File

@@ -0,0 +1,82 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const HTMLElement = require("./HTMLElement.js");
const impl = utils.implSymbol;
function HTMLDataListElement() {
throw new TypeError("Illegal constructor");
}
HTMLDataListElement.prototype = Object.create(HTMLElement.interface.prototype);
HTMLDataListElement.prototype.constructor = HTMLDataListElement;
HTMLDataListElement.prototype.toString = function () {
if (this === HTMLDataListElement.prototype) {
return "[object HTMLDataListElementPrototype]";
}
return HTMLElement.interface.prototype.toString.call(this);
};
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(HTMLDataListElement.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(HTMLDataListElement.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
HTMLElement._internalSetup(obj);
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: HTMLDataListElement,
expose: {
Window: { HTMLDataListElement: HTMLDataListElement }
}
};
module.exports = iface;
const Impl = require("../nodes/HTMLDataListElement-impl.js");

View File

@@ -0,0 +1,98 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const HTMLElement = require("./HTMLElement.js");
const impl = utils.implSymbol;
function HTMLDialogElement() {
throw new TypeError("Illegal constructor");
}
HTMLDialogElement.prototype = Object.create(HTMLElement.interface.prototype);
HTMLDialogElement.prototype.constructor = HTMLDialogElement;
HTMLDialogElement.prototype.toString = function () {
if (this === HTMLDialogElement.prototype) {
return "[object HTMLDialogElementPrototype]";
}
return HTMLElement.interface.prototype.toString.call(this);
};
Object.defineProperty(HTMLDialogElement.prototype, "open", {
get() {
return this.hasAttribute("open");
},
set(V) {
V = conversions["boolean"](V);
if (V) {
this.setAttribute("open", "");
} else {
this.removeAttribute("open");
}
},
enumerable: true,
configurable: true
});
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(HTMLDialogElement.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(HTMLDialogElement.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
HTMLElement._internalSetup(obj);
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: HTMLDialogElement,
expose: {
Window: { HTMLDialogElement: HTMLDialogElement }
}
};
module.exports = iface;
const Impl = require("../nodes/HTMLDialogElement-impl.js");

View File

@@ -0,0 +1,98 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const HTMLElement = require("./HTMLElement.js");
const impl = utils.implSymbol;
function HTMLDirectoryElement() {
throw new TypeError("Illegal constructor");
}
HTMLDirectoryElement.prototype = Object.create(HTMLElement.interface.prototype);
HTMLDirectoryElement.prototype.constructor = HTMLDirectoryElement;
HTMLDirectoryElement.prototype.toString = function () {
if (this === HTMLDirectoryElement.prototype) {
return "[object HTMLDirectoryElementPrototype]";
}
return HTMLElement.interface.prototype.toString.call(this);
};
Object.defineProperty(HTMLDirectoryElement.prototype, "compact", {
get() {
return this.hasAttribute("compact");
},
set(V) {
V = conversions["boolean"](V);
if (V) {
this.setAttribute("compact", "");
} else {
this.removeAttribute("compact");
}
},
enumerable: true,
configurable: true
});
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(HTMLDirectoryElement.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(HTMLDirectoryElement.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
HTMLElement._internalSetup(obj);
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: HTMLDirectoryElement,
expose: {
Window: { HTMLDirectoryElement: HTMLDirectoryElement }
}
};
module.exports = iface;
const Impl = require("../nodes/HTMLDirectoryElement-impl.js");

View File

@@ -0,0 +1,95 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const HTMLElement = require("./HTMLElement.js");
const impl = utils.implSymbol;
function HTMLDivElement() {
throw new TypeError("Illegal constructor");
}
HTMLDivElement.prototype = Object.create(HTMLElement.interface.prototype);
HTMLDivElement.prototype.constructor = HTMLDivElement;
HTMLDivElement.prototype.toString = function () {
if (this === HTMLDivElement.prototype) {
return "[object HTMLDivElementPrototype]";
}
return HTMLElement.interface.prototype.toString.call(this);
};
Object.defineProperty(HTMLDivElement.prototype, "align", {
get() {
const value = this.getAttribute("align");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("align", V);
},
enumerable: true,
configurable: true
});
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(HTMLDivElement.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(HTMLDivElement.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
HTMLElement._internalSetup(obj);
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: HTMLDivElement,
expose: {
Window: { HTMLDivElement: HTMLDivElement }
}
};
module.exports = iface;
const Impl = require("../nodes/HTMLDivElement-impl.js");

View File

@@ -0,0 +1,245 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const Element = require("./Element.js");
const impl = utils.implSymbol;
const mixin = utils.mixin;
const ElementCSSInlineStyle = require("./ElementCSSInlineStyle.js");
const GlobalEventHandlers = require("./GlobalEventHandlers.js");
const ElementContentEditable = require("./ElementContentEditable.js");
function HTMLElement() {
throw new TypeError("Illegal constructor");
}
HTMLElement.prototype = Object.create(Element.interface.prototype);
HTMLElement.prototype.constructor = HTMLElement;
mixin(HTMLElement.prototype, ElementCSSInlineStyle.interface.prototype);
ElementCSSInlineStyle.mixedInto.push(HTMLElement);
mixin(HTMLElement.prototype, GlobalEventHandlers.interface.prototype);
GlobalEventHandlers.mixedInto.push(HTMLElement);
mixin(HTMLElement.prototype, ElementContentEditable.interface.prototype);
ElementContentEditable.mixedInto.push(HTMLElement);
HTMLElement.prototype.click = function click() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const args = [];
for (let i = 0; i < arguments.length && i < 0; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
return this[impl].click.apply(this[impl], args);
};
HTMLElement.prototype.focus = function focus() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const args = [];
for (let i = 0; i < arguments.length && i < 0; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
return this[impl].focus.apply(this[impl], args);
};
HTMLElement.prototype.blur = function blur() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const args = [];
for (let i = 0; i < arguments.length && i < 0; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
return this[impl].blur.apply(this[impl], args);
};
HTMLElement.prototype.toString = function () {
if (this === HTMLElement.prototype) {
return "[object HTMLElementPrototype]";
}
return Element.interface.prototype.toString.call(this);
};
Object.defineProperty(HTMLElement.prototype, "title", {
get() {
const value = this.getAttribute("title");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("title", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLElement.prototype, "lang", {
get() {
const value = this.getAttribute("lang");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("lang", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLElement.prototype, "dir", {
get() {
const value = this.getAttribute("dir");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("dir", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLElement.prototype, "hidden", {
get() {
return this.hasAttribute("hidden");
},
set(V) {
V = conversions["boolean"](V);
if (V) {
this.setAttribute("hidden", "");
} else {
this.removeAttribute("hidden");
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLElement.prototype, "tabIndex", {
get() {
return this[impl].tabIndex;
},
set(V) {
V = conversions["long"](V);
this[impl].tabIndex = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLElement.prototype, "accessKey", {
get() {
const value = this.getAttribute("accessKey");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("accessKey", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLElement.prototype, "offsetParent", {
get() {
return utils.tryWrapperForImpl(this[impl].offsetParent);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLElement.prototype, "offsetTop", {
get() {
return this[impl].offsetTop;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLElement.prototype, "offsetLeft", {
get() {
return this[impl].offsetLeft;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLElement.prototype, "offsetWidth", {
get() {
return this[impl].offsetWidth;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLElement.prototype, "offsetHeight", {
get() {
return this[impl].offsetHeight;
},
enumerable: true,
configurable: true
});
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(HTMLElement.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(HTMLElement.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
Element._internalSetup(obj);
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: HTMLElement,
expose: {
Window: { HTMLElement: HTMLElement }
}
};
module.exports = iface;
const Impl = require("../nodes/HTMLElement-impl.js");

View File

@@ -0,0 +1,159 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const HTMLElement = require("./HTMLElement.js");
const impl = utils.implSymbol;
function HTMLEmbedElement() {
throw new TypeError("Illegal constructor");
}
HTMLEmbedElement.prototype = Object.create(HTMLElement.interface.prototype);
HTMLEmbedElement.prototype.constructor = HTMLEmbedElement;
HTMLEmbedElement.prototype.toString = function () {
if (this === HTMLEmbedElement.prototype) {
return "[object HTMLEmbedElementPrototype]";
}
return HTMLElement.interface.prototype.toString.call(this);
};
Object.defineProperty(HTMLEmbedElement.prototype, "src", {
get() {
return this[impl].src;
},
set(V) {
V = conversions["DOMString"](V);
this[impl].src = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLEmbedElement.prototype, "type", {
get() {
const value = this.getAttribute("type");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("type", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLEmbedElement.prototype, "width", {
get() {
const value = this.getAttribute("width");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("width", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLEmbedElement.prototype, "height", {
get() {
const value = this.getAttribute("height");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("height", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLEmbedElement.prototype, "align", {
get() {
const value = this.getAttribute("align");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("align", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLEmbedElement.prototype, "name", {
get() {
const value = this.getAttribute("name");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("name", V);
},
enumerable: true,
configurable: true
});
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(HTMLEmbedElement.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(HTMLEmbedElement.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
HTMLElement._internalSetup(obj);
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: HTMLEmbedElement,
expose: {
Window: { HTMLEmbedElement: HTMLEmbedElement }
}
};
module.exports = iface;
const Impl = require("../nodes/HTMLEmbedElement-impl.js");

View File

@@ -0,0 +1,119 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const HTMLElement = require("./HTMLElement.js");
const impl = utils.implSymbol;
function HTMLFieldSetElement() {
throw new TypeError("Illegal constructor");
}
HTMLFieldSetElement.prototype = Object.create(HTMLElement.interface.prototype);
HTMLFieldSetElement.prototype.constructor = HTMLFieldSetElement;
HTMLFieldSetElement.prototype.toString = function () {
if (this === HTMLFieldSetElement.prototype) {
return "[object HTMLFieldSetElementPrototype]";
}
return HTMLElement.interface.prototype.toString.call(this);
};
Object.defineProperty(HTMLFieldSetElement.prototype, "disabled", {
get() {
return this.hasAttribute("disabled");
},
set(V) {
V = conversions["boolean"](V);
if (V) {
this.setAttribute("disabled", "");
} else {
this.removeAttribute("disabled");
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFieldSetElement.prototype, "form", {
get() {
return utils.tryWrapperForImpl(this[impl].form);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFieldSetElement.prototype, "name", {
get() {
const value = this.getAttribute("name");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("name", V);
},
enumerable: true,
configurable: true
});
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(HTMLFieldSetElement.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(HTMLFieldSetElement.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
HTMLElement._internalSetup(obj);
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: HTMLFieldSetElement,
expose: {
Window: { HTMLFieldSetElement: HTMLFieldSetElement }
}
};
module.exports = iface;
const Impl = require("../nodes/HTMLFieldSetElement-impl.js");

View File

@@ -0,0 +1,121 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const HTMLElement = require("./HTMLElement.js");
const impl = utils.implSymbol;
function HTMLFontElement() {
throw new TypeError("Illegal constructor");
}
HTMLFontElement.prototype = Object.create(HTMLElement.interface.prototype);
HTMLFontElement.prototype.constructor = HTMLFontElement;
HTMLFontElement.prototype.toString = function () {
if (this === HTMLFontElement.prototype) {
return "[object HTMLFontElementPrototype]";
}
return HTMLElement.interface.prototype.toString.call(this);
};
Object.defineProperty(HTMLFontElement.prototype, "color", {
get() {
const value = this.getAttribute("color");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V, { treatNullAsEmptyString: true });
this.setAttribute("color", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFontElement.prototype, "face", {
get() {
const value = this.getAttribute("face");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("face", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFontElement.prototype, "size", {
get() {
const value = this.getAttribute("size");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("size", V);
},
enumerable: true,
configurable: true
});
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(HTMLFontElement.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(HTMLFontElement.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
HTMLElement._internalSetup(obj);
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: HTMLFontElement,
expose: {
Window: { HTMLFontElement: HTMLFontElement }
}
};
module.exports = iface;
const Impl = require("../nodes/HTMLFontElement-impl.js");

View File

@@ -0,0 +1,211 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const HTMLElement = require("./HTMLElement.js");
const impl = utils.implSymbol;
function HTMLFormElement() {
throw new TypeError("Illegal constructor");
}
HTMLFormElement.prototype = Object.create(HTMLElement.interface.prototype);
HTMLFormElement.prototype.constructor = HTMLFormElement;
HTMLFormElement.prototype.submit = function submit() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const args = [];
for (let i = 0; i < arguments.length && i < 0; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
return this[impl].submit.apply(this[impl], args);
};
HTMLFormElement.prototype.reset = function reset() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const args = [];
for (let i = 0; i < arguments.length && i < 0; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
return this[impl].reset.apply(this[impl], args);
};
HTMLFormElement.prototype.toString = function () {
if (this === HTMLFormElement.prototype) {
return "[object HTMLFormElementPrototype]";
}
return HTMLElement.interface.prototype.toString.call(this);
};
Object.defineProperty(HTMLFormElement.prototype, "acceptCharset", {
get() {
const value = this.getAttribute("accept-charset");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("accept-charset", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFormElement.prototype, "action", {
get() {
return this[impl].action;
},
set(V) {
V = conversions["DOMString"](V);
this[impl].action = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFormElement.prototype, "enctype", {
get() {
return this[impl].enctype;
},
set(V) {
V = conversions["DOMString"](V);
this[impl].enctype = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFormElement.prototype, "method", {
get() {
return this[impl].method;
},
set(V) {
V = conversions["DOMString"](V);
this[impl].method = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFormElement.prototype, "name", {
get() {
const value = this.getAttribute("name");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("name", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFormElement.prototype, "noValidate", {
get() {
return this.hasAttribute("noValidate");
},
set(V) {
V = conversions["boolean"](V);
if (V) {
this.setAttribute("noValidate", "");
} else {
this.removeAttribute("noValidate");
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFormElement.prototype, "target", {
get() {
const value = this.getAttribute("target");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("target", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFormElement.prototype, "elements", {
get() {
return utils.tryWrapperForImpl(this[impl].elements);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFormElement.prototype, "length", {
get() {
return this[impl].length;
},
enumerable: true,
configurable: true
});
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(HTMLFormElement.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(HTMLFormElement.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
HTMLElement._internalSetup(obj);
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: HTMLFormElement,
expose: {
Window: { HTMLFormElement: HTMLFormElement }
}
};
module.exports = iface;
const Impl = require("../nodes/HTMLFormElement-impl.js");

View File

@@ -0,0 +1,203 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const HTMLElement = require("./HTMLElement.js");
const impl = utils.implSymbol;
function HTMLFrameElement() {
throw new TypeError("Illegal constructor");
}
HTMLFrameElement.prototype = Object.create(HTMLElement.interface.prototype);
HTMLFrameElement.prototype.constructor = HTMLFrameElement;
HTMLFrameElement.prototype.toString = function () {
if (this === HTMLFrameElement.prototype) {
return "[object HTMLFrameElementPrototype]";
}
return HTMLElement.interface.prototype.toString.call(this);
};
Object.defineProperty(HTMLFrameElement.prototype, "name", {
get() {
const value = this.getAttribute("name");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("name", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFrameElement.prototype, "scrolling", {
get() {
const value = this.getAttribute("scrolling");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("scrolling", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFrameElement.prototype, "src", {
get() {
return this[impl].src;
},
set(V) {
V = conversions["DOMString"](V);
this[impl].src = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFrameElement.prototype, "frameBorder", {
get() {
const value = this.getAttribute("frameBorder");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("frameBorder", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFrameElement.prototype, "longDesc", {
get() {
return this[impl].longDesc;
},
set(V) {
V = conversions["DOMString"](V);
this[impl].longDesc = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFrameElement.prototype, "noResize", {
get() {
return this.hasAttribute("noResize");
},
set(V) {
V = conversions["boolean"](V);
if (V) {
this.setAttribute("noResize", "");
} else {
this.removeAttribute("noResize");
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFrameElement.prototype, "contentDocument", {
get() {
return utils.tryWrapperForImpl(this[impl].contentDocument);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFrameElement.prototype, "contentWindow", {
get() {
return utils.tryWrapperForImpl(this[impl].contentWindow);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFrameElement.prototype, "marginHeight", {
get() {
const value = this.getAttribute("marginHeight");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V, { treatNullAsEmptyString: true });
this.setAttribute("marginHeight", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFrameElement.prototype, "marginWidth", {
get() {
const value = this.getAttribute("marginWidth");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V, { treatNullAsEmptyString: true });
this.setAttribute("marginWidth", V);
},
enumerable: true,
configurable: true
});
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(HTMLFrameElement.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(HTMLFrameElement.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
HTMLElement._internalSetup(obj);
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: HTMLFrameElement,
expose: {
Window: { HTMLFrameElement: HTMLFrameElement }
}
};
module.exports = iface;
const Impl = require("../nodes/HTMLFrameElement-impl.js");

View File

@@ -0,0 +1,112 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const HTMLElement = require("./HTMLElement.js");
const impl = utils.implSymbol;
const mixin = utils.mixin;
const WindowEventHandlers = require("./WindowEventHandlers.js");
function HTMLFrameSetElement() {
throw new TypeError("Illegal constructor");
}
HTMLFrameSetElement.prototype = Object.create(HTMLElement.interface.prototype);
HTMLFrameSetElement.prototype.constructor = HTMLFrameSetElement;
mixin(HTMLFrameSetElement.prototype, WindowEventHandlers.interface.prototype);
WindowEventHandlers.mixedInto.push(HTMLFrameSetElement);
HTMLFrameSetElement.prototype.toString = function () {
if (this === HTMLFrameSetElement.prototype) {
return "[object HTMLFrameSetElementPrototype]";
}
return HTMLElement.interface.prototype.toString.call(this);
};
Object.defineProperty(HTMLFrameSetElement.prototype, "cols", {
get() {
const value = this.getAttribute("cols");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("cols", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLFrameSetElement.prototype, "rows", {
get() {
const value = this.getAttribute("rows");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("rows", V);
},
enumerable: true,
configurable: true
});
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(HTMLFrameSetElement.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(HTMLFrameSetElement.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
HTMLElement._internalSetup(obj);
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: HTMLFrameSetElement,
expose: {
Window: { HTMLFrameSetElement: HTMLFrameSetElement }
}
};
module.exports = iface;
const Impl = require("../nodes/HTMLFrameSetElement-impl.js");

View File

@@ -0,0 +1,150 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const HTMLElement = require("./HTMLElement.js");
const impl = utils.implSymbol;
function HTMLHRElement() {
throw new TypeError("Illegal constructor");
}
HTMLHRElement.prototype = Object.create(HTMLElement.interface.prototype);
HTMLHRElement.prototype.constructor = HTMLHRElement;
HTMLHRElement.prototype.toString = function () {
if (this === HTMLHRElement.prototype) {
return "[object HTMLHRElementPrototype]";
}
return HTMLElement.interface.prototype.toString.call(this);
};
Object.defineProperty(HTMLHRElement.prototype, "align", {
get() {
const value = this.getAttribute("align");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("align", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLHRElement.prototype, "color", {
get() {
const value = this.getAttribute("color");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("color", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLHRElement.prototype, "noShade", {
get() {
return this.hasAttribute("noShade");
},
set(V) {
V = conversions["boolean"](V);
if (V) {
this.setAttribute("noShade", "");
} else {
this.removeAttribute("noShade");
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLHRElement.prototype, "size", {
get() {
const value = this.getAttribute("size");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("size", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLHRElement.prototype, "width", {
get() {
const value = this.getAttribute("width");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("width", V);
},
enumerable: true,
configurable: true
});
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(HTMLHRElement.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(HTMLHRElement.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
HTMLElement._internalSetup(obj);
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: HTMLHRElement,
expose: {
Window: { HTMLHRElement: HTMLHRElement }
}
};
module.exports = iface;
const Impl = require("../nodes/HTMLHRElement-impl.js");

View File

@@ -0,0 +1,82 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const HTMLElement = require("./HTMLElement.js");
const impl = utils.implSymbol;
function HTMLHeadElement() {
throw new TypeError("Illegal constructor");
}
HTMLHeadElement.prototype = Object.create(HTMLElement.interface.prototype);
HTMLHeadElement.prototype.constructor = HTMLHeadElement;
HTMLHeadElement.prototype.toString = function () {
if (this === HTMLHeadElement.prototype) {
return "[object HTMLHeadElementPrototype]";
}
return HTMLElement.interface.prototype.toString.call(this);
};
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(HTMLHeadElement.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(HTMLHeadElement.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
HTMLElement._internalSetup(obj);
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: HTMLHeadElement,
expose: {
Window: { HTMLHeadElement: HTMLHeadElement }
}
};
module.exports = iface;
const Impl = require("../nodes/HTMLHeadElement-impl.js");

View File

@@ -0,0 +1,95 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const HTMLElement = require("./HTMLElement.js");
const impl = utils.implSymbol;
function HTMLHeadingElement() {
throw new TypeError("Illegal constructor");
}
HTMLHeadingElement.prototype = Object.create(HTMLElement.interface.prototype);
HTMLHeadingElement.prototype.constructor = HTMLHeadingElement;
HTMLHeadingElement.prototype.toString = function () {
if (this === HTMLHeadingElement.prototype) {
return "[object HTMLHeadingElementPrototype]";
}
return HTMLElement.interface.prototype.toString.call(this);
};
Object.defineProperty(HTMLHeadingElement.prototype, "align", {
get() {
const value = this.getAttribute("align");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("align", V);
},
enumerable: true,
configurable: true
});
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(HTMLHeadingElement.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(HTMLHeadingElement.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
HTMLElement._internalSetup(obj);
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: HTMLHeadingElement,
expose: {
Window: { HTMLHeadingElement: HTMLHeadingElement }
}
};
module.exports = iface;
const Impl = require("../nodes/HTMLHeadingElement-impl.js");

View File

@@ -0,0 +1,95 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const HTMLElement = require("./HTMLElement.js");
const impl = utils.implSymbol;
function HTMLHtmlElement() {
throw new TypeError("Illegal constructor");
}
HTMLHtmlElement.prototype = Object.create(HTMLElement.interface.prototype);
HTMLHtmlElement.prototype.constructor = HTMLHtmlElement;
HTMLHtmlElement.prototype.toString = function () {
if (this === HTMLHtmlElement.prototype) {
return "[object HTMLHtmlElementPrototype]";
}
return HTMLElement.interface.prototype.toString.call(this);
};
Object.defineProperty(HTMLHtmlElement.prototype, "version", {
get() {
const value = this.getAttribute("version");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("version", V);
},
enumerable: true,
configurable: true
});
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(HTMLHtmlElement.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(HTMLHtmlElement.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
HTMLElement._internalSetup(obj);
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: HTMLHtmlElement,
expose: {
Window: { HTMLHtmlElement: HTMLHtmlElement }
}
};
module.exports = iface;
const Impl = require("../nodes/HTMLHtmlElement-impl.js");

View File

@@ -0,0 +1,205 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const impl = utils.implSymbol;
function HTMLHyperlinkElementUtils() {
throw new TypeError("Illegal constructor");
}
Object.defineProperty(HTMLHyperlinkElementUtils.prototype, "href", {
get() {
return this[impl].href;
},
set(V) {
V = conversions["USVString"](V);
this[impl].href = V;
},
enumerable: true,
configurable: true
});
HTMLHyperlinkElementUtils.prototype.toString = function () {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl].href;;
};
Object.defineProperty(HTMLHyperlinkElementUtils.prototype, "origin", {
get() {
return this[impl].origin;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLHyperlinkElementUtils.prototype, "protocol", {
get() {
return this[impl].protocol;
},
set(V) {
V = conversions["USVString"](V);
this[impl].protocol = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLHyperlinkElementUtils.prototype, "username", {
get() {
return this[impl].username;
},
set(V) {
V = conversions["USVString"](V);
this[impl].username = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLHyperlinkElementUtils.prototype, "password", {
get() {
return this[impl].password;
},
set(V) {
V = conversions["USVString"](V);
this[impl].password = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLHyperlinkElementUtils.prototype, "host", {
get() {
return this[impl].host;
},
set(V) {
V = conversions["USVString"](V);
this[impl].host = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLHyperlinkElementUtils.prototype, "hostname", {
get() {
return this[impl].hostname;
},
set(V) {
V = conversions["USVString"](V);
this[impl].hostname = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLHyperlinkElementUtils.prototype, "port", {
get() {
return this[impl].port;
},
set(V) {
V = conversions["USVString"](V);
this[impl].port = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLHyperlinkElementUtils.prototype, "pathname", {
get() {
return this[impl].pathname;
},
set(V) {
V = conversions["USVString"](V);
this[impl].pathname = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLHyperlinkElementUtils.prototype, "search", {
get() {
return this[impl].search;
},
set(V) {
V = conversions["USVString"](V);
this[impl].search = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLHyperlinkElementUtils.prototype, "hash", {
get() {
return this[impl].hash;
},
set(V) {
V = conversions["USVString"](V);
this[impl].hash = V;
},
enumerable: true,
configurable: true
});
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(HTMLHyperlinkElementUtils.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(HTMLHyperlinkElementUtils.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: HTMLHyperlinkElementUtils,
expose: {
}
};
module.exports = iface;
const Impl = require("../nodes/HTMLHyperlinkElementUtils-impl.js");

View File

@@ -0,0 +1,278 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const HTMLElement = require("./HTMLElement.js");
const impl = utils.implSymbol;
function HTMLIFrameElement() {
throw new TypeError("Illegal constructor");
}
HTMLIFrameElement.prototype = Object.create(HTMLElement.interface.prototype);
HTMLIFrameElement.prototype.constructor = HTMLIFrameElement;
HTMLIFrameElement.prototype.getSVGDocument = function getSVGDocument() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const args = [];
for (let i = 0; i < arguments.length && i < 0; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
return utils.tryWrapperForImpl(this[impl].getSVGDocument.apply(this[impl], args));
};
HTMLIFrameElement.prototype.toString = function () {
if (this === HTMLIFrameElement.prototype) {
return "[object HTMLIFrameElementPrototype]";
}
return HTMLElement.interface.prototype.toString.call(this);
};
Object.defineProperty(HTMLIFrameElement.prototype, "src", {
get() {
return this[impl].src;
},
set(V) {
V = conversions["DOMString"](V);
this[impl].src = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLIFrameElement.prototype, "srcdoc", {
get() {
const value = this.getAttribute("srcdoc");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("srcdoc", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLIFrameElement.prototype, "name", {
get() {
const value = this.getAttribute("name");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("name", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLIFrameElement.prototype, "seamless", {
get() {
return this[impl].seamless;
},
set(V) {
V = conversions["boolean"](V);
this[impl].seamless = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLIFrameElement.prototype, "allowFullscreen", {
get() {
return this.hasAttribute("allowFullscreen");
},
set(V) {
V = conversions["boolean"](V);
if (V) {
this.setAttribute("allowFullscreen", "");
} else {
this.removeAttribute("allowFullscreen");
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLIFrameElement.prototype, "width", {
get() {
const value = this.getAttribute("width");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("width", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLIFrameElement.prototype, "height", {
get() {
const value = this.getAttribute("height");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("height", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLIFrameElement.prototype, "contentDocument", {
get() {
return utils.tryWrapperForImpl(this[impl].contentDocument);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLIFrameElement.prototype, "contentWindow", {
get() {
return utils.tryWrapperForImpl(this[impl].contentWindow);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLIFrameElement.prototype, "align", {
get() {
const value = this.getAttribute("align");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("align", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLIFrameElement.prototype, "scrolling", {
get() {
const value = this.getAttribute("scrolling");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("scrolling", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLIFrameElement.prototype, "frameBorder", {
get() {
const value = this.getAttribute("frameBorder");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("frameBorder", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLIFrameElement.prototype, "longDesc", {
get() {
return this[impl].longDesc;
},
set(V) {
V = conversions["DOMString"](V);
this[impl].longDesc = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLIFrameElement.prototype, "marginHeight", {
get() {
const value = this.getAttribute("marginHeight");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V, { treatNullAsEmptyString: true });
this.setAttribute("marginHeight", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLIFrameElement.prototype, "marginWidth", {
get() {
const value = this.getAttribute("marginWidth");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V, { treatNullAsEmptyString: true });
this.setAttribute("marginWidth", V);
},
enumerable: true,
configurable: true
});
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(HTMLIFrameElement.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(HTMLIFrameElement.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
HTMLElement._internalSetup(obj);
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: HTMLIFrameElement,
expose: {
Window: { HTMLIFrameElement: HTMLIFrameElement }
}
};
module.exports = iface;
const Impl = require("../nodes/HTMLIFrameElement-impl.js");

View File

@@ -0,0 +1,326 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const HTMLElement = require("./HTMLElement.js");
const impl = utils.implSymbol;
function HTMLImageElement() {
throw new TypeError("Illegal constructor");
}
HTMLImageElement.prototype = Object.create(HTMLElement.interface.prototype);
HTMLImageElement.prototype.constructor = HTMLImageElement;
HTMLImageElement.prototype.toString = function () {
if (this === HTMLImageElement.prototype) {
return "[object HTMLImageElementPrototype]";
}
return HTMLElement.interface.prototype.toString.call(this);
};
Object.defineProperty(HTMLImageElement.prototype, "alt", {
get() {
const value = this.getAttribute("alt");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("alt", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLImageElement.prototype, "src", {
get() {
return this[impl].src;
},
set(V) {
V = conversions["DOMString"](V);
this[impl].src = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLImageElement.prototype, "srcset", {
get() {
const value = this.getAttribute("srcset");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("srcset", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLImageElement.prototype, "sizes", {
get() {
const value = this.getAttribute("sizes");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("sizes", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLImageElement.prototype, "crossOrigin", {
get() {
const value = this.getAttribute("crossOrigin");
return value === null ? "" : value;
},
set(V) {
if (V === null || V === undefined) {
V = null;
} else {
V = conversions["DOMString"](V);
}
this.setAttribute("crossOrigin", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLImageElement.prototype, "useMap", {
get() {
const value = this.getAttribute("useMap");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("useMap", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLImageElement.prototype, "isMap", {
get() {
return this.hasAttribute("isMap");
},
set(V) {
V = conversions["boolean"](V);
if (V) {
this.setAttribute("isMap", "");
} else {
this.removeAttribute("isMap");
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLImageElement.prototype, "width", {
get() {
return this[impl].width;
},
set(V) {
V = conversions["unsigned long"](V);
this[impl].width = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLImageElement.prototype, "height", {
get() {
return this[impl].height;
},
set(V) {
V = conversions["unsigned long"](V);
this[impl].height = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLImageElement.prototype, "naturalWidth", {
get() {
return this[impl].naturalWidth;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLImageElement.prototype, "naturalHeight", {
get() {
return this[impl].naturalHeight;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLImageElement.prototype, "complete", {
get() {
return this[impl].complete;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLImageElement.prototype, "currentSrc", {
get() {
return this[impl].currentSrc;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLImageElement.prototype, "name", {
get() {
const value = this.getAttribute("name");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("name", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLImageElement.prototype, "lowsrc", {
get() {
const value = this.getAttribute("lowsrc");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("lowsrc", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLImageElement.prototype, "align", {
get() {
const value = this.getAttribute("align");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("align", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLImageElement.prototype, "hspace", {
get() {
const value = parseInt(this.getAttribute("hspace"));
return isNaN(value) || value < -2147483648 || value > 2147483647 ? 0 : value
},
set(V) {
V = conversions["long"](V);
this.setAttribute("hspace", String(V));
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLImageElement.prototype, "vspace", {
get() {
const value = parseInt(this.getAttribute("vspace"));
return isNaN(value) || value < -2147483648 || value > 2147483647 ? 0 : value
},
set(V) {
V = conversions["long"](V);
this.setAttribute("vspace", String(V));
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLImageElement.prototype, "longDesc", {
get() {
const value = this.getAttribute("longDesc");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("longDesc", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLImageElement.prototype, "border", {
get() {
const value = this.getAttribute("border");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V, { treatNullAsEmptyString: true });
this.setAttribute("border", V);
},
enumerable: true,
configurable: true
});
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(HTMLImageElement.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(HTMLImageElement.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
HTMLElement._internalSetup(obj);
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: HTMLImageElement,
expose: {
Window: { HTMLImageElement: HTMLImageElement }
}
};
module.exports = iface;
const Impl = require("../nodes/HTMLImageElement-impl.js");

View File

@@ -0,0 +1,583 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const HTMLElement = require("./HTMLElement.js");
const impl = utils.implSymbol;
function HTMLInputElement() {
throw new TypeError("Illegal constructor");
}
HTMLInputElement.prototype = Object.create(HTMLElement.interface.prototype);
HTMLInputElement.prototype.constructor = HTMLInputElement;
HTMLInputElement.prototype.select = function select() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const args = [];
for (let i = 0; i < arguments.length && i < 0; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
return this[impl].select.apply(this[impl], args);
};
HTMLInputElement.prototype.setRangeText = function setRangeText(replacement) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 1) {
throw new TypeError("Failed to execute 'setRangeText' on 'HTMLInputElement': 1 argument required, but only " + arguments.length + " present.");
}
const args = [];
for (let i = 0; i < arguments.length && i < 4; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
args[0] = conversions["DOMString"](args[0]);
return this[impl].setRangeText.apply(this[impl], args);
};
HTMLInputElement.prototype.setSelectionRange = function setSelectionRange(start, end) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 2) {
throw new TypeError("Failed to execute 'setSelectionRange' on 'HTMLInputElement': 2 arguments required, but only " + arguments.length + " present.");
}
const args = [];
for (let i = 0; i < arguments.length && i < 3; ++i) {
args[i] = utils.tryImplForWrapper(arguments[i]);
}
args[0] = conversions["unsigned long"](args[0]);
args[1] = conversions["unsigned long"](args[1]);
if (args[2] !== undefined) {
args[2] = conversions["DOMString"](args[2]);
}
return this[impl].setSelectionRange.apply(this[impl], args);
};
HTMLInputElement.prototype.toString = function () {
if (this === HTMLInputElement.prototype) {
return "[object HTMLInputElementPrototype]";
}
return HTMLElement.interface.prototype.toString.call(this);
};
Object.defineProperty(HTMLInputElement.prototype, "accept", {
get() {
const value = this.getAttribute("accept");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("accept", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "alt", {
get() {
const value = this.getAttribute("alt");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("alt", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "autocomplete", {
get() {
const value = this.getAttribute("autocomplete");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("autocomplete", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "autofocus", {
get() {
return this.hasAttribute("autofocus");
},
set(V) {
V = conversions["boolean"](V);
if (V) {
this.setAttribute("autofocus", "");
} else {
this.removeAttribute("autofocus");
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "defaultChecked", {
get() {
return this.hasAttribute("checked");
},
set(V) {
V = conversions["boolean"](V);
if (V) {
this.setAttribute("checked", "");
} else {
this.removeAttribute("checked");
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "checked", {
get() {
return this[impl].checked;
},
set(V) {
V = conversions["boolean"](V);
this[impl].checked = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "dirName", {
get() {
const value = this.getAttribute("dirName");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("dirName", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "disabled", {
get() {
return this.hasAttribute("disabled");
},
set(V) {
V = conversions["boolean"](V);
if (V) {
this.setAttribute("disabled", "");
} else {
this.removeAttribute("disabled");
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "form", {
get() {
return utils.tryWrapperForImpl(this[impl].form);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "files", {
get() {
return utils.tryWrapperForImpl(this[impl].files);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "formNoValidate", {
get() {
return this.hasAttribute("formNoValidate");
},
set(V) {
V = conversions["boolean"](V);
if (V) {
this.setAttribute("formNoValidate", "");
} else {
this.removeAttribute("formNoValidate");
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "formTarget", {
get() {
const value = this.getAttribute("formTarget");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("formTarget", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "inputMode", {
get() {
const value = this.getAttribute("inputMode");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("inputMode", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "max", {
get() {
const value = this.getAttribute("max");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("max", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "maxLength", {
get() {
return this[impl].maxLength;
},
set(V) {
V = conversions["long"](V);
this[impl].maxLength = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "min", {
get() {
const value = this.getAttribute("min");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("min", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "minLength", {
get() {
return this[impl].minLength;
},
set(V) {
V = conversions["long"](V);
this[impl].minLength = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "multiple", {
get() {
return this.hasAttribute("multiple");
},
set(V) {
V = conversions["boolean"](V);
if (V) {
this.setAttribute("multiple", "");
} else {
this.removeAttribute("multiple");
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "name", {
get() {
const value = this.getAttribute("name");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("name", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "pattern", {
get() {
const value = this.getAttribute("pattern");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("pattern", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "placeholder", {
get() {
const value = this.getAttribute("placeholder");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("placeholder", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "readOnly", {
get() {
return this.hasAttribute("readOnly");
},
set(V) {
V = conversions["boolean"](V);
if (V) {
this.setAttribute("readOnly", "");
} else {
this.removeAttribute("readOnly");
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "required", {
get() {
return this.hasAttribute("required");
},
set(V) {
V = conversions["boolean"](V);
if (V) {
this.setAttribute("required", "");
} else {
this.removeAttribute("required");
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "size", {
get() {
return this[impl].size;
},
set(V) {
V = conversions["unsigned long"](V);
this[impl].size = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "src", {
get() {
const value = this.getAttribute("src");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("src", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "step", {
get() {
const value = this.getAttribute("step");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("step", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "type", {
get() {
return this[impl].type;
},
set(V) {
V = conversions["DOMString"](V);
this[impl].type = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "defaultValue", {
get() {
const value = this.getAttribute("value");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("value", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "value", {
get() {
return this[impl].value;
},
set(V) {
V = conversions["DOMString"](V, { treatNullAsEmptyString: true });
this[impl].value = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "selectionStart", {
get() {
return this[impl].selectionStart;
},
set(V) {
if (V === null || V === undefined) {
V = null;
} else {
V = conversions["unsigned long"](V);
}
this[impl].selectionStart = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "selectionEnd", {
get() {
return this[impl].selectionEnd;
},
set(V) {
if (V === null || V === undefined) {
V = null;
} else {
V = conversions["unsigned long"](V);
}
this[impl].selectionEnd = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "selectionDirection", {
get() {
return this[impl].selectionDirection;
},
set(V) {
if (V === null || V === undefined) {
V = null;
} else {
V = conversions["DOMString"](V);
}
this[impl].selectionDirection = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "align", {
get() {
const value = this.getAttribute("align");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("align", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "useMap", {
get() {
const value = this.getAttribute("useMap");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("useMap", V);
},
enumerable: true,
configurable: true
});
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(HTMLInputElement.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(HTMLInputElement.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
HTMLElement._internalSetup(obj);
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: HTMLInputElement,
expose: {
Window: { HTMLInputElement: HTMLInputElement }
}
};
module.exports = iface;
const Impl = require("../nodes/HTMLInputElement-impl.js");

View File

@@ -0,0 +1,108 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const HTMLElement = require("./HTMLElement.js");
const impl = utils.implSymbol;
function HTMLLIElement() {
throw new TypeError("Illegal constructor");
}
HTMLLIElement.prototype = Object.create(HTMLElement.interface.prototype);
HTMLLIElement.prototype.constructor = HTMLLIElement;
HTMLLIElement.prototype.toString = function () {
if (this === HTMLLIElement.prototype) {
return "[object HTMLLIElementPrototype]";
}
return HTMLElement.interface.prototype.toString.call(this);
};
Object.defineProperty(HTMLLIElement.prototype, "value", {
get() {
const value = parseInt(this.getAttribute("value"));
return isNaN(value) || value < -2147483648 || value > 2147483647 ? 0 : value
},
set(V) {
V = conversions["long"](V);
this.setAttribute("value", String(V));
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLLIElement.prototype, "type", {
get() {
const value = this.getAttribute("type");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("type", V);
},
enumerable: true,
configurable: true
});
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(HTMLLIElement.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(HTMLLIElement.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
HTMLElement._internalSetup(obj);
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: HTMLLIElement,
expose: {
Window: { HTMLLIElement: HTMLLIElement }
}
};
module.exports = iface;
const Impl = require("../nodes/HTMLLIElement-impl.js");

View File

@@ -0,0 +1,103 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const HTMLElement = require("./HTMLElement.js");
const impl = utils.implSymbol;
function HTMLLabelElement() {
throw new TypeError("Illegal constructor");
}
HTMLLabelElement.prototype = Object.create(HTMLElement.interface.prototype);
HTMLLabelElement.prototype.constructor = HTMLLabelElement;
HTMLLabelElement.prototype.toString = function () {
if (this === HTMLLabelElement.prototype) {
return "[object HTMLLabelElementPrototype]";
}
return HTMLElement.interface.prototype.toString.call(this);
};
Object.defineProperty(HTMLLabelElement.prototype, "form", {
get() {
return utils.tryWrapperForImpl(this[impl].form);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLLabelElement.prototype, "htmlFor", {
get() {
const value = this.getAttribute("for");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("for", V);
},
enumerable: true,
configurable: true
});
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(HTMLLabelElement.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(HTMLLabelElement.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
HTMLElement._internalSetup(obj);
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: HTMLLabelElement,
expose: {
Window: { HTMLLabelElement: HTMLLabelElement }
}
};
module.exports = iface;
const Impl = require("../nodes/HTMLLabelElement-impl.js");

View File

@@ -0,0 +1,103 @@
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const HTMLElement = require("./HTMLElement.js");
const impl = utils.implSymbol;
function HTMLLegendElement() {
throw new TypeError("Illegal constructor");
}
HTMLLegendElement.prototype = Object.create(HTMLElement.interface.prototype);
HTMLLegendElement.prototype.constructor = HTMLLegendElement;
HTMLLegendElement.prototype.toString = function () {
if (this === HTMLLegendElement.prototype) {
return "[object HTMLLegendElementPrototype]";
}
return HTMLElement.interface.prototype.toString.call(this);
};
Object.defineProperty(HTMLLegendElement.prototype, "form", {
get() {
return utils.tryWrapperForImpl(this[impl].form);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLLegendElement.prototype, "align", {
get() {
const value = this.getAttribute("align");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("align", V);
},
enumerable: true,
configurable: true
});
const iface = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(HTMLLegendElement.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(HTMLLegendElement.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
HTMLElement._internalSetup(obj);
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: HTMLLegendElement,
expose: {
Window: { HTMLLegendElement: HTMLLegendElement }
}
};
module.exports = iface;
const Impl = require("../nodes/HTMLLegendElement-impl.js");

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