"use strict"; const conversions = require("webidl-conversions"); const utils = require("./utils.js"); const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; const convertSelectionMode = require("./SelectionMode.js").convert; const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; const impl = utils.implSymbol; const ctorRegistry = utils.ctorRegistrySymbol; const HTMLElement = require("./HTMLElement.js"); const interfaceName = "HTMLTextAreaElement"; /** * When an interface-module that implements this interface as a mixin is loaded, it will append its own `.is()` * method into this array. It allows objects that directly implements *those* interfaces to be recognized as * implementing this mixin interface. */ exports._mixedIntoPredicates = []; exports.is = function is(obj) { if (obj) { if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) { return true; } for (const isMixedInto of exports._mixedIntoPredicates) { if (isMixedInto(obj)) { return true; } } } return false; }; exports.isImpl = function isImpl(obj) { if (obj) { if (obj instanceof Impl.implementation) { return true; } const wrapper = utils.wrapperForImpl(obj); for (const isMixedInto of exports._mixedIntoPredicates) { if (isMixedInto(wrapper)) { return true; } } } return false; }; exports.convert = function convert(obj, { context = "The provided value" } = {}) { if (exports.is(obj)) { return utils.implForWrapper(obj); } throw new TypeError(`${context} is not of type 'HTMLTextAreaElement'.`); }; exports.create = function create(globalObject, constructorArgs, privateData) { if (globalObject[ctorRegistry] === undefined) { throw new Error("Internal error: invalid global object"); } const ctor = globalObject[ctorRegistry]["HTMLTextAreaElement"]; if (ctor === undefined) { throw new Error("Internal error: constructor HTMLTextAreaElement is not installed on the passed global object"); } let obj = Object.create(ctor.prototype); obj = exports.setup(obj, globalObject, constructorArgs, privateData); return obj; }; exports.createImpl = function createImpl(globalObject, constructorArgs, privateData) { const obj = exports.create(globalObject, constructorArgs, privateData); return utils.implForWrapper(obj); }; exports._internalSetup = function _internalSetup(obj) { HTMLElement._internalSetup(obj); }; exports.setup = function setup(obj, globalObject, constructorArgs = [], privateData = {}) { privateData.wrapper = obj; exports._internalSetup(obj); Object.defineProperty(obj, impl, { value: new Impl.implementation(globalObject, constructorArgs, privateData), configurable: true }); obj[impl][utils.wrapperSymbol] = obj; if (Impl.init) { Impl.init(obj[impl], privateData); } return obj; }; exports.install = function install(globalObject) { if (globalObject.HTMLElement === undefined) { throw new Error("Internal error: attempting to evaluate HTMLTextAreaElement before HTMLElement"); } class HTMLTextAreaElement extends globalObject.HTMLElement { constructor() { return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); } checkValidity() { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } return this[impl].checkValidity(); } reportValidity() { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } return this[impl].reportValidity(); } setCustomValidity(error) { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } if (arguments.length < 1) { throw new TypeError( "Failed to execute 'setCustomValidity' on 'HTMLTextAreaElement': 1 argument required, but only " + arguments.length + " present." ); } const args = []; { let curArg = arguments[0]; curArg = conversions["DOMString"](curArg, { context: "Failed to execute 'setCustomValidity' on 'HTMLTextAreaElement': parameter 1" }); args.push(curArg); } return this[impl].setCustomValidity(...args); } select() { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } return this[impl].select(); } setRangeText(replacement) { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } if (arguments.length < 1) { throw new TypeError( "Failed to execute 'setRangeText' on 'HTMLTextAreaElement': 1 argument required, but only " + arguments.length + " present." ); } const args = []; switch (arguments.length) { case 1: { let curArg = arguments[0]; curArg = conversions["DOMString"](curArg, { context: "Failed to execute 'setRangeText' on 'HTMLTextAreaElement': parameter 1" }); args.push(curArg); } break; case 2: throw new TypeError( "Failed to execute 'setRangeText' on 'HTMLTextAreaElement': only " + arguments.length + " arguments present." ); break; case 3: { let curArg = arguments[0]; curArg = conversions["DOMString"](curArg, { context: "Failed to execute 'setRangeText' on 'HTMLTextAreaElement': parameter 1" }); args.push(curArg); } { let curArg = arguments[1]; curArg = conversions["unsigned long"](curArg, { context: "Failed to execute 'setRangeText' on 'HTMLTextAreaElement': parameter 2" }); args.push(curArg); } { let curArg = arguments[2]; curArg = conversions["unsigned long"](curArg, { context: "Failed to execute 'setRangeText' on 'HTMLTextAreaElement': parameter 3" }); args.push(curArg); } break; default: { let curArg = arguments[0]; curArg = conversions["DOMString"](curArg, { context: "Failed to execute 'setRangeText' on 'HTMLTextAreaElement': parameter 1" }); args.push(curArg); } { let curArg = arguments[1]; curArg = conversions["unsigned long"](curArg, { context: "Failed to execute 'setRangeText' on 'HTMLTextAreaElement': parameter 2" }); args.push(curArg); } { let curArg = arguments[2]; curArg = conversions["unsigned long"](curArg, { context: "Failed to execute 'setRangeText' on 'HTMLTextAreaElement': parameter 3" }); args.push(curArg); } { let curArg = arguments[3]; if (curArg !== undefined) { curArg = convertSelectionMode(curArg, { context: "Failed to execute 'setRangeText' on 'HTMLTextAreaElement': parameter 4" }); } else { curArg = "preserve"; } args.push(curArg); } } return this[impl].setRangeText(...args); } setSelectionRange(start, end) { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } if (arguments.length < 2) { throw new TypeError( "Failed to execute 'setSelectionRange' on 'HTMLTextAreaElement': 2 arguments required, but only " + arguments.length + " present." ); } const args = []; { let curArg = arguments[0]; curArg = conversions["unsigned long"](curArg, { context: "Failed to execute 'setSelectionRange' on 'HTMLTextAreaElement': parameter 1" }); args.push(curArg); } { let curArg = arguments[1]; curArg = conversions["unsigned long"](curArg, { context: "Failed to execute 'setSelectionRange' on 'HTMLTextAreaElement': parameter 2" }); args.push(curArg); } { let curArg = arguments[2]; if (curArg !== undefined) { curArg = conversions["DOMString"](curArg, { context: "Failed to execute 'setSelectionRange' on 'HTMLTextAreaElement': parameter 3" }); } args.push(curArg); } return this[impl].setSelectionRange(...args); } get autocomplete() { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } ceReactionsPreSteps_helpers_custom_elements(globalObject); try { const value = this[impl].getAttributeNS(null, "autocomplete"); return value === null ? "" : value; } finally { ceReactionsPostSteps_helpers_custom_elements(globalObject); } } set autocomplete(V) { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } V = conversions["DOMString"](V, { context: "Failed to set the 'autocomplete' property on 'HTMLTextAreaElement': The provided value" }); ceReactionsPreSteps_helpers_custom_elements(globalObject); try { this[impl].setAttributeNS(null, "autocomplete", V); } finally { ceReactionsPostSteps_helpers_custom_elements(globalObject); } } get autofocus() { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } ceReactionsPreSteps_helpers_custom_elements(globalObject); try { return this[impl].hasAttributeNS(null, "autofocus"); } finally { ceReactionsPostSteps_helpers_custom_elements(globalObject); } } set autofocus(V) { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } V = conversions["boolean"](V, { context: "Failed to set the 'autofocus' property on 'HTMLTextAreaElement': The provided value" }); ceReactionsPreSteps_helpers_custom_elements(globalObject); try { if (V) { this[impl].setAttributeNS(null, "autofocus", ""); } else { this[impl].removeAttributeNS(null, "autofocus"); } } finally { ceReactionsPostSteps_helpers_custom_elements(globalObject); } } get cols() { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } ceReactionsPreSteps_helpers_custom_elements(globalObject); try { return this[impl]["cols"]; } finally { ceReactionsPostSteps_helpers_custom_elements(globalObject); } } set cols(V) { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } V = conversions["unsigned long"](V, { context: "Failed to set the 'cols' property on 'HTMLTextAreaElement': The provided value" }); ceReactionsPreSteps_helpers_custom_elements(globalObject); try { this[impl]["cols"] = V; } finally { ceReactionsPostSteps_helpers_custom_elements(globalObject); } } get dirName() { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } ceReactionsPreSteps_helpers_custom_elements(globalObject); try { const value = this[impl].getAttributeNS(null, "dirname"); return value === null ? "" : value; } finally { ceReactionsPostSteps_helpers_custom_elements(globalObject); } } set dirName(V) { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } V = conversions["DOMString"](V, { context: "Failed to set the 'dirName' property on 'HTMLTextAreaElement': The provided value" }); ceReactionsPreSteps_helpers_custom_elements(globalObject); try { this[impl].setAttributeNS(null, "dirname", V); } finally { ceReactionsPostSteps_helpers_custom_elements(globalObject); } } get disabled() { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } ceReactionsPreSteps_helpers_custom_elements(globalObject); try { return this[impl].hasAttributeNS(null, "disabled"); } finally { ceReactionsPostSteps_helpers_custom_elements(globalObject); } } set disabled(V) { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } V = conversions["boolean"](V, { context: "Failed to set the 'disabled' property on 'HTMLTextAreaElement': The provided value" }); ceReactionsPreSteps_helpers_custom_elements(globalObject); try { if (V) { this[impl].setAttributeNS(null, "disabled", ""); } else { this[impl].removeAttributeNS(null, "disabled"); } } finally { ceReactionsPostSteps_helpers_custom_elements(globalObject); } } get form() { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } return utils.tryWrapperForImpl(this[impl]["form"]); } get inputMode() { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } ceReactionsPreSteps_helpers_custom_elements(globalObject); try { const value = this[impl].getAttributeNS(null, "inputmode"); return value === null ? "" : value; } finally { ceReactionsPostSteps_helpers_custom_elements(globalObject); } } set inputMode(V) { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } V = conversions["DOMString"](V, { context: "Failed to set the 'inputMode' property on 'HTMLTextAreaElement': The provided value" }); ceReactionsPreSteps_helpers_custom_elements(globalObject); try { this[impl].setAttributeNS(null, "inputmode", V); } finally { ceReactionsPostSteps_helpers_custom_elements(globalObject); } } get maxLength() { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } ceReactionsPreSteps_helpers_custom_elements(globalObject); try { const value = parseInt(this[impl].getAttributeNS(null, "maxlength")); return isNaN(value) || value < -2147483648 || value > 2147483647 ? 0 : value; } finally { ceReactionsPostSteps_helpers_custom_elements(globalObject); } } set maxLength(V) { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } V = conversions["long"](V, { context: "Failed to set the 'maxLength' property on 'HTMLTextAreaElement': The provided value" }); ceReactionsPreSteps_helpers_custom_elements(globalObject); try { this[impl].setAttributeNS(null, "maxlength", String(V)); } finally { ceReactionsPostSteps_helpers_custom_elements(globalObject); } } get minLength() { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } ceReactionsPreSteps_helpers_custom_elements(globalObject); try { const value = parseInt(this[impl].getAttributeNS(null, "minlength")); return isNaN(value) || value < -2147483648 || value > 2147483647 ? 0 : value; } finally { ceReactionsPostSteps_helpers_custom_elements(globalObject); } } set minLength(V) { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } V = conversions["long"](V, { context: "Failed to set the 'minLength' property on 'HTMLTextAreaElement': The provided value" }); ceReactionsPreSteps_helpers_custom_elements(globalObject); try { this[impl].setAttributeNS(null, "minlength", String(V)); } finally { ceReactionsPostSteps_helpers_custom_elements(globalObject); } } get name() { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } ceReactionsPreSteps_helpers_custom_elements(globalObject); try { const value = this[impl].getAttributeNS(null, "name"); return value === null ? "" : value; } finally { ceReactionsPostSteps_helpers_custom_elements(globalObject); } } set name(V) { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } V = conversions["DOMString"](V, { context: "Failed to set the 'name' property on 'HTMLTextAreaElement': The provided value" }); ceReactionsPreSteps_helpers_custom_elements(globalObject); try { this[impl].setAttributeNS(null, "name", V); } finally { ceReactionsPostSteps_helpers_custom_elements(globalObject); } } get placeholder() { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } ceReactionsPreSteps_helpers_custom_elements(globalObject); try { const value = this[impl].getAttributeNS(null, "placeholder"); return value === null ? "" : value; } finally { ceReactionsPostSteps_helpers_custom_elements(globalObject); } } set placeholder(V) { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } V = conversions["DOMString"](V, { context: "Failed to set the 'placeholder' property on 'HTMLTextAreaElement': The provided value" }); ceReactionsPreSteps_helpers_custom_elements(globalObject); try { this[impl].setAttributeNS(null, "placeholder", V); } finally { ceReactionsPostSteps_helpers_custom_elements(globalObject); } } get readOnly() { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } ceReactionsPreSteps_helpers_custom_elements(globalObject); try { return this[impl].hasAttributeNS(null, "readonly"); } finally { ceReactionsPostSteps_helpers_custom_elements(globalObject); } } set readOnly(V) { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } V = conversions["boolean"](V, { context: "Failed to set the 'readOnly' property on 'HTMLTextAreaElement': The provided value" }); ceReactionsPreSteps_helpers_custom_elements(globalObject); try { if (V) { this[impl].setAttributeNS(null, "readonly", ""); } else { this[impl].removeAttributeNS(null, "readonly"); } } finally { ceReactionsPostSteps_helpers_custom_elements(globalObject); } } get required() { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } ceReactionsPreSteps_helpers_custom_elements(globalObject); try { return this[impl].hasAttributeNS(null, "required"); } finally { ceReactionsPostSteps_helpers_custom_elements(globalObject); } } set required(V) { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } V = conversions["boolean"](V, { context: "Failed to set the 'required' property on 'HTMLTextAreaElement': The provided value" }); ceReactionsPreSteps_helpers_custom_elements(globalObject); try { if (V) { this[impl].setAttributeNS(null, "required", ""); } else { this[impl].removeAttributeNS(null, "required"); } } finally { ceReactionsPostSteps_helpers_custom_elements(globalObject); } } get rows() { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } ceReactionsPreSteps_helpers_custom_elements(globalObject); try { return this[impl]["rows"]; } finally { ceReactionsPostSteps_helpers_custom_elements(globalObject); } } set rows(V) { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } V = conversions["unsigned long"](V, { context: "Failed to set the 'rows' property on 'HTMLTextAreaElement': The provided value" }); ceReactionsPreSteps_helpers_custom_elements(globalObject); try { this[impl]["rows"] = V; } finally { ceReactionsPostSteps_helpers_custom_elements(globalObject); } } get wrap() { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } ceReactionsPreSteps_helpers_custom_elements(globalObject); try { const value = this[impl].getAttributeNS(null, "wrap"); return value === null ? "" : value; } finally { ceReactionsPostSteps_helpers_custom_elements(globalObject); } } set wrap(V) { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } V = conversions["DOMString"](V, { context: "Failed to set the 'wrap' property on 'HTMLTextAreaElement': The provided value" }); ceReactionsPreSteps_helpers_custom_elements(globalObject); try { this[impl].setAttributeNS(null, "wrap", V); } finally { ceReactionsPostSteps_helpers_custom_elements(globalObject); } } get type() { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } return this[impl]["type"]; } get defaultValue() { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } ceReactionsPreSteps_helpers_custom_elements(globalObject); try { return this[impl]["defaultValue"]; } finally { ceReactionsPostSteps_helpers_custom_elements(globalObject); } } set defaultValue(V) { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } V = conversions["DOMString"](V, { context: "Failed to set the 'defaultValue' property on 'HTMLTextAreaElement': The provided value" }); ceReactionsPreSteps_helpers_custom_elements(globalObject); try { this[impl]["defaultValue"] = V; } finally { ceReactionsPostSteps_helpers_custom_elements(globalObject); } } get value() { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } ceReactionsPreSteps_helpers_custom_elements(globalObject); try { return this[impl]["value"]; } finally { ceReactionsPostSteps_helpers_custom_elements(globalObject); } } set value(V) { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } V = conversions["DOMString"](V, { context: "Failed to set the 'value' property on 'HTMLTextAreaElement': The provided value", treatNullAsEmptyString: true }); ceReactionsPreSteps_helpers_custom_elements(globalObject); try { this[impl]["value"] = V; } finally { ceReactionsPostSteps_helpers_custom_elements(globalObject); } } get textLength() { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } return this[impl]["textLength"]; } get willValidate() { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } return this[impl]["willValidate"]; } get validity() { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } return utils.tryWrapperForImpl(this[impl]["validity"]); } get validationMessage() { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } return this[impl]["validationMessage"]; } get labels() { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } return utils.tryWrapperForImpl(this[impl]["labels"]); } get selectionStart() { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } return this[impl]["selectionStart"]; } set selectionStart(V) { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } V = conversions["unsigned long"](V, { context: "Failed to set the 'selectionStart' property on 'HTMLTextAreaElement': The provided value" }); this[impl]["selectionStart"] = V; } get selectionEnd() { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } return this[impl]["selectionEnd"]; } set selectionEnd(V) { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } V = conversions["unsigned long"](V, { context: "Failed to set the 'selectionEnd' property on 'HTMLTextAreaElement': The provided value" }); this[impl]["selectionEnd"] = V; } get selectionDirection() { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } return this[impl]["selectionDirection"]; } set selectionDirection(V) { if (!this || !exports.is(this)) { throw new TypeError("Illegal invocation"); } V = conversions["DOMString"](V, { context: "Failed to set the 'selectionDirection' property on 'HTMLTextAreaElement': The provided value" }); this[impl]["selectionDirection"] = V; } } Object.defineProperties(HTMLTextAreaElement.prototype, { checkValidity: { enumerable: true }, reportValidity: { enumerable: true }, setCustomValidity: { enumerable: true }, select: { enumerable: true }, setRangeText: { enumerable: true }, setSelectionRange: { enumerable: true }, autocomplete: { enumerable: true }, autofocus: { enumerable: true }, cols: { enumerable: true }, dirName: { enumerable: true }, disabled: { enumerable: true }, form: { enumerable: true }, inputMode: { enumerable: true }, maxLength: { enumerable: true }, minLength: { enumerable: true }, name: { enumerable: true }, placeholder: { enumerable: true }, readOnly: { enumerable: true }, required: { enumerable: true }, rows: { enumerable: true }, wrap: { enumerable: true }, type: { enumerable: true }, defaultValue: { enumerable: true }, value: { enumerable: true }, textLength: { enumerable: true }, willValidate: { enumerable: true }, validity: { enumerable: true }, validationMessage: { enumerable: true }, labels: { enumerable: true }, selectionStart: { enumerable: true }, selectionEnd: { enumerable: true }, selectionDirection: { enumerable: true }, [Symbol.toStringTag]: { value: "HTMLTextAreaElement", configurable: true } }); if (globalObject[ctorRegistry] === undefined) { globalObject[ctorRegistry] = Object.create(null); } globalObject[ctorRegistry][interfaceName] = HTMLTextAreaElement; Object.defineProperty(globalObject, interfaceName, { configurable: true, writable: true, value: HTMLTextAreaElement }); }; const Impl = require("../nodes/HTMLTextAreaElement-impl.js");