UNPKG

jsdom

Version:

A JavaScript implementation of many web standards

1,407 lines (1,196 loc) • 47.8 kB
"use strict"; const conversions = require("webidl-conversions"); const utils = require("./utils.js"); const HTMLConstructor_jsdom_living_helpers_html_constructor = require("../../jsdom/living/helpers/html-constructor.js").HTMLConstructor; const SelectionMode = require("./SelectionMode.js"); const ceReactionsPreSteps_jsdom_living_helpers_custom_elements = require("../../jsdom/living/helpers/custom-elements.js").ceReactionsPreSteps; const ceReactionsPostSteps_jsdom_living_helpers_custom_elements = require("../../jsdom/living/helpers/custom-elements.js").ceReactionsPostSteps; const FileList = require("./FileList.js"); const parseNonNegativeInteger_jsdom_living_helpers_strings = require("../../jsdom/living/helpers/strings.js").parseNonNegativeInteger; const create_DOMException = require("./DOMException.js").create; const serializeURLwhatwg_url = require("whatwg-url").serializeURL; const ctorRegistrySymbol = utils.ctorRegistrySymbol; const HTMLElement = require("./HTMLElement.js"); const interfaceName = "HTMLInputElement"; const $interfaceDescriptor = utils.createInterfaceDescriptor(() => HTMLElement.interfaceDescriptor); exports.interfaceDescriptor = $interfaceDescriptor; function $requireImpl(wrapper, globalObject, context) { return utils.requireImplForWrapper(wrapper, $interfaceDescriptor, globalObject, interfaceName, context); } exports.is = value => { return utils.implForWrapperWithInterface(value, $interfaceDescriptor) !== null; }; exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { const impl = utils.implForWrapperWithInterface(value, $interfaceDescriptor); if (impl !== null) { return impl; } throw new globalObject.TypeError(`${context} is not of type 'HTMLInputElement'.`); }; function makeWrapper(globalObject, newTarget) { let proto; if (newTarget !== undefined) { proto = newTarget.prototype; } if (!utils.isObject(proto)) { proto = globalObject[ctorRegistrySymbol]["HTMLInputElement"].prototype; } return Object.create(proto); } exports.create = (globalObject, constructorArgs, privateData) => { const wrapper = makeWrapper(globalObject); return exports.setup(wrapper, globalObject, constructorArgs, privateData); }; exports.createImpl = (globalObject, constructorArgs, privateData) => { const wrapper = exports.create(globalObject, constructorArgs, privateData); return utils.implForWrapper(wrapper); }; exports._internalSetup = (wrapper, globalObject) => { HTMLElement._internalSetup(wrapper, globalObject); }; exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { privateData.wrapper = wrapper; exports._internalSetup(wrapper, globalObject); const impl = new Impl.implementation(globalObject, constructorArgs, privateData); utils.registerWrapper(wrapper, impl, $interfaceDescriptor); impl[utils.wrapperSymbol] = wrapper; if (Impl.init) { Impl.init(impl); } return wrapper; }; exports.new = (globalObject, newTarget) => { const wrapper = makeWrapper(globalObject, newTarget); exports._internalSetup(wrapper, globalObject); const impl = Object.create(Impl.implementation.prototype); utils.registerWrapper(wrapper, impl, $interfaceDescriptor); impl[utils.wrapperSymbol] = wrapper; if (Impl.init) { Impl.init(impl); } return impl; }; const exposed = new Set(["Window"]); exports.install = (globalObject, globalNames) => { if (!globalNames.some(globalName => exposed.has(globalName))) { return; } const ctorRegistry = utils.initCtorRegistry(globalObject); class HTMLInputElement extends globalObject.HTMLElement { constructor() { return HTMLConstructor_jsdom_living_helpers_html_constructor(globalObject, interfaceName, new.target); } stepUp() { const $impl = $requireImpl(this ?? globalObject, globalObject, "stepUp"); const args = []; { let curArg = arguments[0]; if (curArg !== undefined) { curArg = conversions["long"](curArg, { context: "Failed to execute 'stepUp' on 'HTMLInputElement': parameter 1", globals: globalObject }); } else { curArg = 1; } args.push(curArg); } return $impl.stepUp(...args); } stepDown() { const $impl = $requireImpl(this ?? globalObject, globalObject, "stepDown"); const args = []; { let curArg = arguments[0]; if (curArg !== undefined) { curArg = conversions["long"](curArg, { context: "Failed to execute 'stepDown' on 'HTMLInputElement': parameter 1", globals: globalObject }); } else { curArg = 1; } args.push(curArg); } return $impl.stepDown(...args); } checkValidity() { const $impl = $requireImpl(this ?? globalObject, globalObject, "checkValidity"); return $impl.checkValidity(); } reportValidity() { const $impl = $requireImpl(this ?? globalObject, globalObject, "reportValidity"); return $impl.reportValidity(); } setCustomValidity(error) { const $impl = $requireImpl(this ?? globalObject, globalObject, "setCustomValidity"); if (arguments.length < 1) { throw new globalObject.TypeError( `Failed to execute 'setCustomValidity' on 'HTMLInputElement': 1 argument required, but only ${arguments.length} present.` ); } const args = []; { let curArg = arguments[0]; curArg = conversions["DOMString"](curArg, { context: "Failed to execute 'setCustomValidity' on 'HTMLInputElement': parameter 1", globals: globalObject }); args.push(curArg); } return $impl.setCustomValidity(...args); } select() { const $impl = $requireImpl(this ?? globalObject, globalObject, "select"); return $impl.select(); } setRangeText(replacement) { const $impl = $requireImpl(this ?? globalObject, globalObject, "setRangeText"); if (arguments.length < 1) { throw new globalObject.TypeError( `Failed to execute 'setRangeText' on 'HTMLInputElement': 1 argument required, but only ${arguments.length} present.` ); } const args = []; switch (arguments.length) { case 1: { let curArg = arguments[0]; curArg = conversions["DOMString"](curArg, { context: "Failed to execute 'setRangeText' on 'HTMLInputElement': parameter 1", globals: globalObject }); args.push(curArg); } break; case 2: throw new globalObject.TypeError( `Failed to execute 'setRangeText' on 'HTMLInputElement': only ${arguments.length} arguments present.` ); break; case 3: { let curArg = arguments[0]; curArg = conversions["DOMString"](curArg, { context: "Failed to execute 'setRangeText' on 'HTMLInputElement': parameter 1", globals: globalObject }); args.push(curArg); } { let curArg = arguments[1]; curArg = conversions["unsigned long"](curArg, { context: "Failed to execute 'setRangeText' on 'HTMLInputElement': parameter 2", globals: globalObject }); args.push(curArg); } { let curArg = arguments[2]; curArg = conversions["unsigned long"](curArg, { context: "Failed to execute 'setRangeText' on 'HTMLInputElement': parameter 3", globals: globalObject }); args.push(curArg); } break; default: { let curArg = arguments[0]; curArg = conversions["DOMString"](curArg, { context: "Failed to execute 'setRangeText' on 'HTMLInputElement': parameter 1", globals: globalObject }); args.push(curArg); } { let curArg = arguments[1]; curArg = conversions["unsigned long"](curArg, { context: "Failed to execute 'setRangeText' on 'HTMLInputElement': parameter 2", globals: globalObject }); args.push(curArg); } { let curArg = arguments[2]; curArg = conversions["unsigned long"](curArg, { context: "Failed to execute 'setRangeText' on 'HTMLInputElement': parameter 3", globals: globalObject }); args.push(curArg); } { let curArg = arguments[3]; if (curArg !== undefined) { curArg = SelectionMode.convert(globalObject, curArg, { context: "Failed to execute 'setRangeText' on 'HTMLInputElement': parameter 4" }); } else { curArg = "preserve"; } args.push(curArg); } } return $impl.setRangeText(...args); } setSelectionRange(start, end) { const $impl = $requireImpl(this ?? globalObject, globalObject, "setSelectionRange"); if (arguments.length < 2) { throw new globalObject.TypeError( `Failed to execute 'setSelectionRange' on 'HTMLInputElement': 2 arguments required, but only ${arguments.length} present.` ); } const args = []; { let curArg = arguments[0]; curArg = conversions["unsigned long"](curArg, { context: "Failed to execute 'setSelectionRange' on 'HTMLInputElement': parameter 1", globals: globalObject }); args.push(curArg); } { let curArg = arguments[1]; curArg = conversions["unsigned long"](curArg, { context: "Failed to execute 'setSelectionRange' on 'HTMLInputElement': parameter 2", globals: globalObject }); args.push(curArg); } { let curArg = arguments[2]; if (curArg !== undefined) { curArg = conversions["DOMString"](curArg, { context: "Failed to execute 'setSelectionRange' on 'HTMLInputElement': parameter 3", globals: globalObject }); } args.push(curArg); } return $impl.setSelectionRange(...args); } get accept() { const $impl = $requireImpl(this ?? globalObject, globalObject, "get accept"); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { const value = $impl._reflectGetTheContentAttribute("accept"); return value === null ? "" : value; } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } set accept(V) { const $impl = $requireImpl(this ?? globalObject, globalObject, "set accept"); V = conversions["DOMString"](V, { context: "Failed to set the 'accept' property on 'HTMLInputElement': The provided value", globals: globalObject }); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { $impl._reflectSetTheContentAttribute("accept", V); } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } get alt() { const $impl = $requireImpl(this ?? globalObject, globalObject, "get alt"); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { const value = $impl._reflectGetTheContentAttribute("alt"); return value === null ? "" : value; } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } set alt(V) { const $impl = $requireImpl(this ?? globalObject, globalObject, "set alt"); V = conversions["DOMString"](V, { context: "Failed to set the 'alt' property on 'HTMLInputElement': The provided value", globals: globalObject }); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { $impl._reflectSetTheContentAttribute("alt", V); } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } get autocomplete() { const $impl = $requireImpl(this ?? globalObject, globalObject, "get autocomplete"); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { const value = $impl._reflectGetTheContentAttribute("autocomplete"); return value === null ? "" : value; } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } set autocomplete(V) { const $impl = $requireImpl(this ?? globalObject, globalObject, "set autocomplete"); V = conversions["DOMString"](V, { context: "Failed to set the 'autocomplete' property on 'HTMLInputElement': The provided value", globals: globalObject }); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { $impl._reflectSetTheContentAttribute("autocomplete", V); } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } get autofocus() { const $impl = $requireImpl(this ?? globalObject, globalObject, "get autofocus"); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { return $impl._reflectGetTheContentAttribute("autofocus") !== null; } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } set autofocus(V) { const $impl = $requireImpl(this ?? globalObject, globalObject, "set autofocus"); V = conversions["boolean"](V, { context: "Failed to set the 'autofocus' property on 'HTMLInputElement': The provided value", globals: globalObject }); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { if (V) { $impl._reflectSetTheContentAttribute("autofocus", ""); } else { $impl._reflectDeleteTheContentAttribute("autofocus"); } } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } get defaultChecked() { const $impl = $requireImpl(this ?? globalObject, globalObject, "get defaultChecked"); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { return $impl._reflectGetTheContentAttribute("checked") !== null; } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } set defaultChecked(V) { const $impl = $requireImpl(this ?? globalObject, globalObject, "set defaultChecked"); V = conversions["boolean"](V, { context: "Failed to set the 'defaultChecked' property on 'HTMLInputElement': The provided value", globals: globalObject }); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { if (V) { $impl._reflectSetTheContentAttribute("checked", ""); } else { $impl._reflectDeleteTheContentAttribute("checked"); } } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } get checked() { const $impl = $requireImpl(this ?? globalObject, globalObject, "get checked"); return $impl["checked"]; } set checked(V) { const $impl = $requireImpl(this ?? globalObject, globalObject, "set checked"); V = conversions["boolean"](V, { context: "Failed to set the 'checked' property on 'HTMLInputElement': The provided value", globals: globalObject }); $impl["checked"] = V; } get dirName() { const $impl = $requireImpl(this ?? globalObject, globalObject, "get dirName"); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { const value = $impl._reflectGetTheContentAttribute("dirname"); return value === null ? "" : value; } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } set dirName(V) { const $impl = $requireImpl(this ?? globalObject, globalObject, "set dirName"); V = conversions["DOMString"](V, { context: "Failed to set the 'dirName' property on 'HTMLInputElement': The provided value", globals: globalObject }); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { $impl._reflectSetTheContentAttribute("dirname", V); } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } get disabled() { const $impl = $requireImpl(this ?? globalObject, globalObject, "get disabled"); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { return $impl._reflectGetTheContentAttribute("disabled") !== null; } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } set disabled(V) { const $impl = $requireImpl(this ?? globalObject, globalObject, "set disabled"); V = conversions["boolean"](V, { context: "Failed to set the 'disabled' property on 'HTMLInputElement': The provided value", globals: globalObject }); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { if (V) { $impl._reflectSetTheContentAttribute("disabled", ""); } else { $impl._reflectDeleteTheContentAttribute("disabled"); } } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } get form() { const $impl = $requireImpl(this ?? globalObject, globalObject, "get form"); return utils.tryWrapperForImpl($impl["form"]); } get files() { const $impl = $requireImpl(this ?? globalObject, globalObject, "get files"); return utils.tryWrapperForImpl($impl["files"]); } set files(V) { const $impl = $requireImpl(this ?? globalObject, globalObject, "set files"); if (V === null || V === undefined) { V = null; } else { V = FileList.convert(globalObject, V, { context: "Failed to set the 'files' property on 'HTMLInputElement': The provided value" }); } $impl["files"] = V; } get formNoValidate() { const $impl = $requireImpl(this ?? globalObject, globalObject, "get formNoValidate"); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { return $impl._reflectGetTheContentAttribute("formnovalidate") !== null; } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } set formNoValidate(V) { const $impl = $requireImpl(this ?? globalObject, globalObject, "set formNoValidate"); V = conversions["boolean"](V, { context: "Failed to set the 'formNoValidate' property on 'HTMLInputElement': The provided value", globals: globalObject }); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { if (V) { $impl._reflectSetTheContentAttribute("formnovalidate", ""); } else { $impl._reflectDeleteTheContentAttribute("formnovalidate"); } } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } get formTarget() { const $impl = $requireImpl(this ?? globalObject, globalObject, "get formTarget"); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { const value = $impl._reflectGetTheContentAttribute("formtarget"); return value === null ? "" : value; } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } set formTarget(V) { const $impl = $requireImpl(this ?? globalObject, globalObject, "set formTarget"); V = conversions["DOMString"](V, { context: "Failed to set the 'formTarget' property on 'HTMLInputElement': The provided value", globals: globalObject }); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { $impl._reflectSetTheContentAttribute("formtarget", V); } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } get indeterminate() { const $impl = $requireImpl(this ?? globalObject, globalObject, "get indeterminate"); return $impl["indeterminate"]; } set indeterminate(V) { const $impl = $requireImpl(this ?? globalObject, globalObject, "set indeterminate"); V = conversions["boolean"](V, { context: "Failed to set the 'indeterminate' property on 'HTMLInputElement': The provided value", globals: globalObject }); $impl["indeterminate"] = V; } get inputMode() { const $impl = $requireImpl(this ?? globalObject, globalObject, "get inputMode"); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { const value = $impl._reflectGetTheContentAttribute("inputmode"); return value === null ? "" : value; } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } set inputMode(V) { const $impl = $requireImpl(this ?? globalObject, globalObject, "set inputMode"); V = conversions["DOMString"](V, { context: "Failed to set the 'inputMode' property on 'HTMLInputElement': The provided value", globals: globalObject }); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { $impl._reflectSetTheContentAttribute("inputmode", V); } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } get list() { const $impl = $requireImpl(this ?? globalObject, globalObject, "get list"); return utils.tryWrapperForImpl($impl["list"]); } get max() { const $impl = $requireImpl(this ?? globalObject, globalObject, "get max"); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { const value = $impl._reflectGetTheContentAttribute("max"); return value === null ? "" : value; } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } set max(V) { const $impl = $requireImpl(this ?? globalObject, globalObject, "set max"); V = conversions["DOMString"](V, { context: "Failed to set the 'max' property on 'HTMLInputElement': The provided value", globals: globalObject }); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { $impl._reflectSetTheContentAttribute("max", V); } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } get maxLength() { const $impl = $requireImpl(this ?? globalObject, globalObject, "get maxLength"); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { let value = $impl._reflectGetTheContentAttribute("maxlength"); if (value !== null) { value = parseNonNegativeInteger_jsdom_living_helpers_strings(value); if (value !== null && conversions.long(value) === value) { return value; } } return -1; } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } set maxLength(V) { const $impl = $requireImpl(this ?? globalObject, globalObject, "set maxLength"); V = conversions["long"](V, { context: "Failed to set the 'maxLength' property on 'HTMLInputElement': The provided value", globals: globalObject }); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { if (V < 0) { throw create_DOMException(globalObject, [ `The negative value ${V} cannot be set for the maxLength property.`, "IndexSizeError" ]); } $impl._reflectSetTheContentAttribute("maxlength", String(V)); } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } get min() { const $impl = $requireImpl(this ?? globalObject, globalObject, "get min"); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { const value = $impl._reflectGetTheContentAttribute("min"); return value === null ? "" : value; } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } set min(V) { const $impl = $requireImpl(this ?? globalObject, globalObject, "set min"); V = conversions["DOMString"](V, { context: "Failed to set the 'min' property on 'HTMLInputElement': The provided value", globals: globalObject }); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { $impl._reflectSetTheContentAttribute("min", V); } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } get minLength() { const $impl = $requireImpl(this ?? globalObject, globalObject, "get minLength"); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { let value = $impl._reflectGetTheContentAttribute("minlength"); if (value !== null) { value = parseNonNegativeInteger_jsdom_living_helpers_strings(value); if (value !== null && conversions.long(value) === value) { return value; } } return -1; } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } set minLength(V) { const $impl = $requireImpl(this ?? globalObject, globalObject, "set minLength"); V = conversions["long"](V, { context: "Failed to set the 'minLength' property on 'HTMLInputElement': The provided value", globals: globalObject }); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { if (V < 0) { throw create_DOMException(globalObject, [ `The negative value ${V} cannot be set for the minLength property.`, "IndexSizeError" ]); } $impl._reflectSetTheContentAttribute("minlength", String(V)); } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } get multiple() { const $impl = $requireImpl(this ?? globalObject, globalObject, "get multiple"); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { return $impl._reflectGetTheContentAttribute("multiple") !== null; } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } set multiple(V) { const $impl = $requireImpl(this ?? globalObject, globalObject, "set multiple"); V = conversions["boolean"](V, { context: "Failed to set the 'multiple' property on 'HTMLInputElement': The provided value", globals: globalObject }); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { if (V) { $impl._reflectSetTheContentAttribute("multiple", ""); } else { $impl._reflectDeleteTheContentAttribute("multiple"); } } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } get name() { const $impl = $requireImpl(this ?? globalObject, globalObject, "get name"); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { const value = $impl._reflectGetTheContentAttribute("name"); return value === null ? "" : value; } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } set name(V) { const $impl = $requireImpl(this ?? globalObject, globalObject, "set name"); V = conversions["DOMString"](V, { context: "Failed to set the 'name' property on 'HTMLInputElement': The provided value", globals: globalObject }); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { $impl._reflectSetTheContentAttribute("name", V); } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } get pattern() { const $impl = $requireImpl(this ?? globalObject, globalObject, "get pattern"); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { const value = $impl._reflectGetTheContentAttribute("pattern"); return value === null ? "" : value; } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } set pattern(V) { const $impl = $requireImpl(this ?? globalObject, globalObject, "set pattern"); V = conversions["DOMString"](V, { context: "Failed to set the 'pattern' property on 'HTMLInputElement': The provided value", globals: globalObject }); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { $impl._reflectSetTheContentAttribute("pattern", V); } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } get placeholder() { const $impl = $requireImpl(this ?? globalObject, globalObject, "get placeholder"); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { const value = $impl._reflectGetTheContentAttribute("placeholder"); return value === null ? "" : value; } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } set placeholder(V) { const $impl = $requireImpl(this ?? globalObject, globalObject, "set placeholder"); V = conversions["DOMString"](V, { context: "Failed to set the 'placeholder' property on 'HTMLInputElement': The provided value", globals: globalObject }); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { $impl._reflectSetTheContentAttribute("placeholder", V); } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } get readOnly() { const $impl = $requireImpl(this ?? globalObject, globalObject, "get readOnly"); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { return $impl._reflectGetTheContentAttribute("readonly") !== null; } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } set readOnly(V) { const $impl = $requireImpl(this ?? globalObject, globalObject, "set readOnly"); V = conversions["boolean"](V, { context: "Failed to set the 'readOnly' property on 'HTMLInputElement': The provided value", globals: globalObject }); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { if (V) { $impl._reflectSetTheContentAttribute("readonly", ""); } else { $impl._reflectDeleteTheContentAttribute("readonly"); } } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } get required() { const $impl = $requireImpl(this ?? globalObject, globalObject, "get required"); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { return $impl._reflectGetTheContentAttribute("required") !== null; } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } set required(V) { const $impl = $requireImpl(this ?? globalObject, globalObject, "set required"); V = conversions["boolean"](V, { context: "Failed to set the 'required' property on 'HTMLInputElement': The provided value", globals: globalObject }); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { if (V) { $impl._reflectSetTheContentAttribute("required", ""); } else { $impl._reflectDeleteTheContentAttribute("required"); } } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } get size() { const $impl = $requireImpl(this ?? globalObject, globalObject, "get size"); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { let value = $impl._reflectGetTheContentAttribute("size"); if (value !== null) { value = parseNonNegativeInteger_jsdom_living_helpers_strings(value); if (value !== null && value >= 1 && value <= 2147483647) { return value; } } return 20; } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } set size(V) { const $impl = $requireImpl(this ?? globalObject, globalObject, "set size"); V = conversions["unsigned long"](V, { context: "Failed to set the 'size' property on 'HTMLInputElement': The provided value", globals: globalObject }); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { if (V === 0) { throw create_DOMException(globalObject, [ `The value ${V} cannot be set for the size property.`, "IndexSizeError" ]); } const newValue = V <= 2147483647 && V >= 1 ? V : 20; $impl._reflectSetTheContentAttribute("size", String(newValue)); } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } get src() { const $impl = $requireImpl(this ?? globalObject, globalObject, "get src"); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { const impl = $impl; const value = impl._reflectGetTheContentAttribute("src"); if (value === null) { return ""; } const document = impl._ownerDocument; if (this._srcURLCacheKey === value && this._baseURLCache === document._baseURLCache) { return this._srcURLCache; } this._srcURLCacheKey = value; this._baseURLCache = document._baseURLCache; const urlRecord = document.encodingParseAURL(value); if (urlRecord !== null) { this._srcURLCache = serializeURLwhatwg_url(urlRecord); return this._srcURLCache; } this._srcURLCache = conversions.USVString(value); return this._srcURLCache; } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } set src(V) { const $impl = $requireImpl(this ?? globalObject, globalObject, "set src"); V = conversions["USVString"](V, { context: "Failed to set the 'src' property on 'HTMLInputElement': The provided value", globals: globalObject }); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { $impl._reflectSetTheContentAttribute("src", V); } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } get step() { const $impl = $requireImpl(this ?? globalObject, globalObject, "get step"); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { const value = $impl._reflectGetTheContentAttribute("step"); return value === null ? "" : value; } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } set step(V) { const $impl = $requireImpl(this ?? globalObject, globalObject, "set step"); V = conversions["DOMString"](V, { context: "Failed to set the 'step' property on 'HTMLInputElement': The provided value", globals: globalObject }); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { $impl._reflectSetTheContentAttribute("step", V); } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } get type() { const $impl = $requireImpl(this ?? globalObject, globalObject, "get type"); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { return $impl["type"]; } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } set type(V) { const $impl = $requireImpl(this ?? globalObject, globalObject, "set type"); V = conversions["DOMString"](V, { context: "Failed to set the 'type' property on 'HTMLInputElement': The provided value", globals: globalObject }); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { $impl["type"] = V; } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } get defaultValue() { const $impl = $requireImpl(this ?? globalObject, globalObject, "get defaultValue"); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { const value = $impl._reflectGetTheContentAttribute("value"); return value === null ? "" : value; } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } set defaultValue(V) { const $impl = $requireImpl(this ?? globalObject, globalObject, "set defaultValue"); V = conversions["DOMString"](V, { context: "Failed to set the 'defaultValue' property on 'HTMLInputElement': The provided value", globals: globalObject }); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { $impl._reflectSetTheContentAttribute("value", V); } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } get value() { const $impl = $requireImpl(this ?? globalObject, globalObject, "get value"); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { return $impl["value"]; } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } set value(V) { const $impl = $requireImpl(this ?? globalObject, globalObject, "set value"); V = conversions["DOMString"](V, { context: "Failed to set the 'value' property on 'HTMLInputElement': The provided value", globals: globalObject, treatNullAsEmptyString: true }); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { $impl["value"] = V; } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } get valueAsDate() { const $impl = $requireImpl(this ?? globalObject, globalObject, "get valueAsDate"); return $impl["valueAsDate"]; } set valueAsDate(V) { const $impl = $requireImpl(this ?? globalObject, globalObject, "set valueAsDate"); if (V === null || V === undefined) { V = null; } else { V = conversions["object"](V, { context: "Failed to set the 'valueAsDate' property on 'HTMLInputElement': The provided value", globals: globalObject }); } $impl["valueAsDate"] = V; } get valueAsNumber() { const $impl = $requireImpl(this ?? globalObject, globalObject, "get valueAsNumber"); return $impl["valueAsNumber"]; } set valueAsNumber(V) { const $impl = $requireImpl(this ?? globalObject, globalObject, "set valueAsNumber"); V = conversions["unrestricted double"](V, { context: "Failed to set the 'valueAsNumber' property on 'HTMLInputElement': The provided value", globals: globalObject }); $impl["valueAsNumber"] = V; } get willValidate() { const $impl = $requireImpl(this ?? globalObject, globalObject, "get willValidate"); return $impl["willValidate"]; } get validity() { const $impl = $requireImpl(this ?? globalObject, globalObject, "get validity"); return utils.tryWrapperForImpl($impl["validity"]); } get validationMessage() { const $impl = $requireImpl(this ?? globalObject, globalObject, "get validationMessage"); return $impl["validationMessage"]; } get labels() { const $impl = $requireImpl(this ?? globalObject, globalObject, "get labels"); return utils.tryWrapperForImpl($impl["labels"]); } get selectionStart() { const $impl = $requireImpl(this ?? globalObject, globalObject, "get selectionStart"); return $impl["selectionStart"]; } set selectionStart(V) { const $impl = $requireImpl(this ?? globalObject, globalObject, "set selectionStart"); if (V === null || V === undefined) { V = null; } else { V = conversions["unsigned long"](V, { context: "Failed to set the 'selectionStart' property on 'HTMLInputElement': The provided value", globals: globalObject }); } $impl["selectionStart"] = V; } get selectionEnd() { const $impl = $requireImpl(this ?? globalObject, globalObject, "get selectionEnd"); return $impl["selectionEnd"]; } set selectionEnd(V) { const $impl = $requireImpl(this ?? globalObject, globalObject, "set selectionEnd"); if (V === null || V === undefined) { V = null; } else { V = conversions["unsigned long"](V, { context: "Failed to set the 'selectionEnd' property on 'HTMLInputElement': The provided value", globals: globalObject }); } $impl["selectionEnd"] = V; } get selectionDirection() { const $impl = $requireImpl(this ?? globalObject, globalObject, "get selectionDirection"); return $impl["selectionDirection"]; } set selectionDirection(V) { const $impl = $requireImpl(this ?? globalObject, globalObject, "set selectionDirection"); if (V === null || V === undefined) { V = null; } else { V = conversions["DOMString"](V, { context: "Failed to set the 'selectionDirection' property on 'HTMLInputElement': The provided value", globals: globalObject }); } $impl["selectionDirection"] = V; } get align() { const $impl = $requireImpl(this ?? globalObject, globalObject, "get align"); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { const value = $impl._reflectGetTheContentAttribute("align"); return value === null ? "" : value; } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } set align(V) { const $impl = $requireImpl(this ?? globalObject, globalObject, "set align"); V = conversions["DOMString"](V, { context: "Failed to set the 'align' property on 'HTMLInputElement': The provided value", globals: globalObject }); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { $impl._reflectSetTheContentAttribute("align", V); } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } get useMap() { const $impl = $requireImpl(this ?? globalObject, globalObject, "get useMap"); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { const value = $impl._reflectGetTheContentAttribute("usemap"); return value === null ? "" : value; } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } set useMap(V) { const $impl = $requireImpl(this ?? globalObject, globalObject, "set useMap"); V = conversions["DOMString"](V, { context: "Failed to set the 'useMap' property on 'HTMLInputElement': The provided value", globals: globalObject }); ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject); try { $impl._reflectSetTheContentAttribute("usemap", V); } finally { ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject); } } } Object.defineProperties(HTMLInputElement.prototype, { stepUp: { enumerable: true }, stepDown: { enumerable: true }, checkValidity: { enumerable: true }, reportValidity: { enumerable: true }, setCustomValidity: { enumerable: true }, select: { enumerable: true }, setRangeText: { enumerable: true }, setSelectionRange: { enumerable: true }, accept: { enumerable: true }, alt: { enumerable: true }, autocomplete: { enumerable: true }, autofocus: { enumerable: true }, defaultChecked: { enumerable: true }, checked: { enumerable: true }, dirName: { enumerable: true }, disabled: { enumerable: true }, form: { enumerable: true }, files: { enumerable: true }, formNoValidate: { enumerable: true }, formTarget: { enumerable: true }, indeterminate: { enumerable: true }, inputMode: { enumerable: true }, list: { enumerable: true }, max: { enumerable: true }, maxLength: { enumerable: true }, min: { enumerable: true }, minLength: { enumerable: true }, multiple: { enumerable: true }, name: { enumerable: true }, pattern: { enumerable: true }, placeholder: { enumerable: true }, readOnly: { enumerable: true }, required: { enumerable: true }, size: { enumerable: true }, src: { enumerable: true }, step: { enumerable: true }, type: { enumerable: true }, defaultValue: { enumerable: true }, value: { enumerable: true }, valueAsDate: { enumerable: true }, valueAsNumber: { enumerable: true }, willValidate: { enumerable: true }, validity: { enumerable: true }, validationMessage: { enumerable: true }, labels: { enumerable: true }, selectionStart: { enumerable: true }, selectionEnd: { enumerable: true }, selectionDirection: { enumerable: true }, align: { enumerable: true }, useMap: { enumerable: true }, [Symbol.toStringTag]: { value: "HTMLInputElement", configurable: true } }); ctorRegistry[interfaceName] = HTMLInputElement; Object.defineProperty(globalObject, interfaceName, { configurable: true, writable: true, value: HTMLInputElement }); }; const Impl = require("../../jsdom/living/nodes/HTMLInputElement-impl.js");