HTMLTextAreaElement.js 40 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210
  1. "use strict";
  2. const conversions = require("webidl-conversions");
  3. const utils = require("./utils.js");
  4. const HTMLConstructor_jsdom_living_helpers_html_constructor =
  5. require("../../jsdom/living/helpers/html-constructor.js").HTMLConstructor;
  6. const SelectionMode = require("./SelectionMode.js");
  7. const ceReactionsPreSteps_jsdom_living_helpers_custom_elements =
  8. require("../../jsdom/living/helpers/custom-elements.js").ceReactionsPreSteps;
  9. const ceReactionsPostSteps_jsdom_living_helpers_custom_elements =
  10. require("../../jsdom/living/helpers/custom-elements.js").ceReactionsPostSteps;
  11. const parseNonNegativeInteger_jsdom_living_helpers_strings =
  12. require("../../jsdom/living/helpers/strings.js").parseNonNegativeInteger;
  13. const create_DOMException = require("./DOMException.js").create;
  14. const implSymbol = utils.implSymbol;
  15. const ctorRegistrySymbol = utils.ctorRegistrySymbol;
  16. const HTMLElement = require("./HTMLElement.js");
  17. const interfaceName = "HTMLTextAreaElement";
  18. exports.is = value => {
  19. return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation;
  20. };
  21. exports.isImpl = value => {
  22. return utils.isObject(value) && value instanceof Impl.implementation;
  23. };
  24. exports.convert = (globalObject, value, { context = "The provided value" } = {}) => {
  25. if (exports.is(value)) {
  26. return utils.implForWrapper(value);
  27. }
  28. throw new globalObject.TypeError(`${context} is not of type 'HTMLTextAreaElement'.`);
  29. };
  30. function makeWrapper(globalObject, newTarget) {
  31. let proto;
  32. if (newTarget !== undefined) {
  33. proto = newTarget.prototype;
  34. }
  35. if (!utils.isObject(proto)) {
  36. proto = globalObject[ctorRegistrySymbol]["HTMLTextAreaElement"].prototype;
  37. }
  38. return Object.create(proto);
  39. }
  40. exports.create = (globalObject, constructorArgs, privateData) => {
  41. const wrapper = makeWrapper(globalObject);
  42. return exports.setup(wrapper, globalObject, constructorArgs, privateData);
  43. };
  44. exports.createImpl = (globalObject, constructorArgs, privateData) => {
  45. const wrapper = exports.create(globalObject, constructorArgs, privateData);
  46. return utils.implForWrapper(wrapper);
  47. };
  48. exports._internalSetup = (wrapper, globalObject) => {
  49. HTMLElement._internalSetup(wrapper, globalObject);
  50. };
  51. exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => {
  52. privateData.wrapper = wrapper;
  53. exports._internalSetup(wrapper, globalObject);
  54. Object.defineProperty(wrapper, implSymbol, {
  55. value: new Impl.implementation(globalObject, constructorArgs, privateData),
  56. configurable: true
  57. });
  58. wrapper[implSymbol][utils.wrapperSymbol] = wrapper;
  59. if (Impl.init) {
  60. Impl.init(wrapper[implSymbol]);
  61. }
  62. return wrapper;
  63. };
  64. exports.new = (globalObject, newTarget) => {
  65. const wrapper = makeWrapper(globalObject, newTarget);
  66. exports._internalSetup(wrapper, globalObject);
  67. Object.defineProperty(wrapper, implSymbol, {
  68. value: Object.create(Impl.implementation.prototype),
  69. configurable: true
  70. });
  71. wrapper[implSymbol][utils.wrapperSymbol] = wrapper;
  72. if (Impl.init) {
  73. Impl.init(wrapper[implSymbol]);
  74. }
  75. return wrapper[implSymbol];
  76. };
  77. const exposed = new Set(["Window"]);
  78. exports.install = (globalObject, globalNames) => {
  79. if (!globalNames.some(globalName => exposed.has(globalName))) {
  80. return;
  81. }
  82. const ctorRegistry = utils.initCtorRegistry(globalObject);
  83. class HTMLTextAreaElement extends globalObject.HTMLElement {
  84. constructor() {
  85. return HTMLConstructor_jsdom_living_helpers_html_constructor(globalObject, interfaceName, new.target);
  86. }
  87. checkValidity() {
  88. const esValue = this !== null && this !== undefined ? this : globalObject;
  89. if (!exports.is(esValue)) {
  90. throw new globalObject.TypeError(
  91. "'checkValidity' called on an object that is not a valid instance of HTMLTextAreaElement."
  92. );
  93. }
  94. return esValue[implSymbol].checkValidity();
  95. }
  96. reportValidity() {
  97. const esValue = this !== null && this !== undefined ? this : globalObject;
  98. if (!exports.is(esValue)) {
  99. throw new globalObject.TypeError(
  100. "'reportValidity' called on an object that is not a valid instance of HTMLTextAreaElement."
  101. );
  102. }
  103. return esValue[implSymbol].reportValidity();
  104. }
  105. setCustomValidity(error) {
  106. const esValue = this !== null && this !== undefined ? this : globalObject;
  107. if (!exports.is(esValue)) {
  108. throw new globalObject.TypeError(
  109. "'setCustomValidity' called on an object that is not a valid instance of HTMLTextAreaElement."
  110. );
  111. }
  112. if (arguments.length < 1) {
  113. throw new globalObject.TypeError(
  114. `Failed to execute 'setCustomValidity' on 'HTMLTextAreaElement': 1 argument required, but only ${arguments.length} present.`
  115. );
  116. }
  117. const args = [];
  118. {
  119. let curArg = arguments[0];
  120. curArg = conversions["DOMString"](curArg, {
  121. context: "Failed to execute 'setCustomValidity' on 'HTMLTextAreaElement': parameter 1",
  122. globals: globalObject
  123. });
  124. args.push(curArg);
  125. }
  126. return esValue[implSymbol].setCustomValidity(...args);
  127. }
  128. select() {
  129. const esValue = this !== null && this !== undefined ? this : globalObject;
  130. if (!exports.is(esValue)) {
  131. throw new globalObject.TypeError(
  132. "'select' called on an object that is not a valid instance of HTMLTextAreaElement."
  133. );
  134. }
  135. return esValue[implSymbol].select();
  136. }
  137. setRangeText(replacement) {
  138. const esValue = this !== null && this !== undefined ? this : globalObject;
  139. if (!exports.is(esValue)) {
  140. throw new globalObject.TypeError(
  141. "'setRangeText' called on an object that is not a valid instance of HTMLTextAreaElement."
  142. );
  143. }
  144. if (arguments.length < 1) {
  145. throw new globalObject.TypeError(
  146. `Failed to execute 'setRangeText' on 'HTMLTextAreaElement': 1 argument required, but only ${arguments.length} present.`
  147. );
  148. }
  149. const args = [];
  150. switch (arguments.length) {
  151. case 1:
  152. {
  153. let curArg = arguments[0];
  154. curArg = conversions["DOMString"](curArg, {
  155. context: "Failed to execute 'setRangeText' on 'HTMLTextAreaElement': parameter 1",
  156. globals: globalObject
  157. });
  158. args.push(curArg);
  159. }
  160. break;
  161. case 2:
  162. throw new globalObject.TypeError(
  163. `Failed to execute 'setRangeText' on 'HTMLTextAreaElement': only ${arguments.length} arguments present.`
  164. );
  165. break;
  166. case 3:
  167. {
  168. let curArg = arguments[0];
  169. curArg = conversions["DOMString"](curArg, {
  170. context: "Failed to execute 'setRangeText' on 'HTMLTextAreaElement': parameter 1",
  171. globals: globalObject
  172. });
  173. args.push(curArg);
  174. }
  175. {
  176. let curArg = arguments[1];
  177. curArg = conversions["unsigned long"](curArg, {
  178. context: "Failed to execute 'setRangeText' on 'HTMLTextAreaElement': parameter 2",
  179. globals: globalObject
  180. });
  181. args.push(curArg);
  182. }
  183. {
  184. let curArg = arguments[2];
  185. curArg = conversions["unsigned long"](curArg, {
  186. context: "Failed to execute 'setRangeText' on 'HTMLTextAreaElement': parameter 3",
  187. globals: globalObject
  188. });
  189. args.push(curArg);
  190. }
  191. break;
  192. default:
  193. {
  194. let curArg = arguments[0];
  195. curArg = conversions["DOMString"](curArg, {
  196. context: "Failed to execute 'setRangeText' on 'HTMLTextAreaElement': parameter 1",
  197. globals: globalObject
  198. });
  199. args.push(curArg);
  200. }
  201. {
  202. let curArg = arguments[1];
  203. curArg = conversions["unsigned long"](curArg, {
  204. context: "Failed to execute 'setRangeText' on 'HTMLTextAreaElement': parameter 2",
  205. globals: globalObject
  206. });
  207. args.push(curArg);
  208. }
  209. {
  210. let curArg = arguments[2];
  211. curArg = conversions["unsigned long"](curArg, {
  212. context: "Failed to execute 'setRangeText' on 'HTMLTextAreaElement': parameter 3",
  213. globals: globalObject
  214. });
  215. args.push(curArg);
  216. }
  217. {
  218. let curArg = arguments[3];
  219. if (curArg !== undefined) {
  220. curArg = SelectionMode.convert(globalObject, curArg, {
  221. context: "Failed to execute 'setRangeText' on 'HTMLTextAreaElement': parameter 4"
  222. });
  223. } else {
  224. curArg = "preserve";
  225. }
  226. args.push(curArg);
  227. }
  228. }
  229. return esValue[implSymbol].setRangeText(...args);
  230. }
  231. setSelectionRange(start, end) {
  232. const esValue = this !== null && this !== undefined ? this : globalObject;
  233. if (!exports.is(esValue)) {
  234. throw new globalObject.TypeError(
  235. "'setSelectionRange' called on an object that is not a valid instance of HTMLTextAreaElement."
  236. );
  237. }
  238. if (arguments.length < 2) {
  239. throw new globalObject.TypeError(
  240. `Failed to execute 'setSelectionRange' on 'HTMLTextAreaElement': 2 arguments required, but only ${arguments.length} present.`
  241. );
  242. }
  243. const args = [];
  244. {
  245. let curArg = arguments[0];
  246. curArg = conversions["unsigned long"](curArg, {
  247. context: "Failed to execute 'setSelectionRange' on 'HTMLTextAreaElement': parameter 1",
  248. globals: globalObject
  249. });
  250. args.push(curArg);
  251. }
  252. {
  253. let curArg = arguments[1];
  254. curArg = conversions["unsigned long"](curArg, {
  255. context: "Failed to execute 'setSelectionRange' on 'HTMLTextAreaElement': parameter 2",
  256. globals: globalObject
  257. });
  258. args.push(curArg);
  259. }
  260. {
  261. let curArg = arguments[2];
  262. if (curArg !== undefined) {
  263. curArg = conversions["DOMString"](curArg, {
  264. context: "Failed to execute 'setSelectionRange' on 'HTMLTextAreaElement': parameter 3",
  265. globals: globalObject
  266. });
  267. }
  268. args.push(curArg);
  269. }
  270. return esValue[implSymbol].setSelectionRange(...args);
  271. }
  272. get autocomplete() {
  273. const esValue = this !== null && this !== undefined ? this : globalObject;
  274. if (!exports.is(esValue)) {
  275. throw new globalObject.TypeError(
  276. "'get autocomplete' called on an object that is not a valid instance of HTMLTextAreaElement."
  277. );
  278. }
  279. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  280. try {
  281. const value = esValue[implSymbol]._reflectGetTheContentAttribute("autocomplete");
  282. return value === null ? "" : value;
  283. } finally {
  284. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  285. }
  286. }
  287. set autocomplete(V) {
  288. const esValue = this !== null && this !== undefined ? this : globalObject;
  289. if (!exports.is(esValue)) {
  290. throw new globalObject.TypeError(
  291. "'set autocomplete' called on an object that is not a valid instance of HTMLTextAreaElement."
  292. );
  293. }
  294. V = conversions["DOMString"](V, {
  295. context: "Failed to set the 'autocomplete' property on 'HTMLTextAreaElement': The provided value",
  296. globals: globalObject
  297. });
  298. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  299. try {
  300. esValue[implSymbol]._reflectSetTheContentAttribute("autocomplete", V);
  301. } finally {
  302. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  303. }
  304. }
  305. get autofocus() {
  306. const esValue = this !== null && this !== undefined ? this : globalObject;
  307. if (!exports.is(esValue)) {
  308. throw new globalObject.TypeError(
  309. "'get autofocus' called on an object that is not a valid instance of HTMLTextAreaElement."
  310. );
  311. }
  312. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  313. try {
  314. return esValue[implSymbol]._reflectGetTheContentAttribute("autofocus") !== null;
  315. } finally {
  316. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  317. }
  318. }
  319. set autofocus(V) {
  320. const esValue = this !== null && this !== undefined ? this : globalObject;
  321. if (!exports.is(esValue)) {
  322. throw new globalObject.TypeError(
  323. "'set autofocus' called on an object that is not a valid instance of HTMLTextAreaElement."
  324. );
  325. }
  326. V = conversions["boolean"](V, {
  327. context: "Failed to set the 'autofocus' property on 'HTMLTextAreaElement': The provided value",
  328. globals: globalObject
  329. });
  330. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  331. try {
  332. if (V) {
  333. esValue[implSymbol]._reflectSetTheContentAttribute("autofocus", "");
  334. } else {
  335. esValue[implSymbol]._reflectDeleteTheContentAttribute("autofocus");
  336. }
  337. } finally {
  338. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  339. }
  340. }
  341. get cols() {
  342. const esValue = this !== null && this !== undefined ? this : globalObject;
  343. if (!exports.is(esValue)) {
  344. throw new globalObject.TypeError(
  345. "'get cols' called on an object that is not a valid instance of HTMLTextAreaElement."
  346. );
  347. }
  348. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  349. try {
  350. let value = esValue[implSymbol]._reflectGetTheContentAttribute("cols");
  351. if (value !== null) {
  352. value = parseNonNegativeInteger_jsdom_living_helpers_strings(value);
  353. if (value !== null && value >= 1 && value <= 2147483647) {
  354. return value;
  355. }
  356. }
  357. return 20;
  358. } finally {
  359. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  360. }
  361. }
  362. set cols(V) {
  363. const esValue = this !== null && this !== undefined ? this : globalObject;
  364. if (!exports.is(esValue)) {
  365. throw new globalObject.TypeError(
  366. "'set cols' called on an object that is not a valid instance of HTMLTextAreaElement."
  367. );
  368. }
  369. V = conversions["unsigned long"](V, {
  370. context: "Failed to set the 'cols' property on 'HTMLTextAreaElement': The provided value",
  371. globals: globalObject
  372. });
  373. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  374. try {
  375. const newValue = V <= 2147483647 && V >= 1 ? V : 20;
  376. esValue[implSymbol]._reflectSetTheContentAttribute("cols", String(newValue));
  377. } finally {
  378. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  379. }
  380. }
  381. get dirName() {
  382. const esValue = this !== null && this !== undefined ? this : globalObject;
  383. if (!exports.is(esValue)) {
  384. throw new globalObject.TypeError(
  385. "'get dirName' called on an object that is not a valid instance of HTMLTextAreaElement."
  386. );
  387. }
  388. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  389. try {
  390. const value = esValue[implSymbol]._reflectGetTheContentAttribute("dirname");
  391. return value === null ? "" : value;
  392. } finally {
  393. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  394. }
  395. }
  396. set dirName(V) {
  397. const esValue = this !== null && this !== undefined ? this : globalObject;
  398. if (!exports.is(esValue)) {
  399. throw new globalObject.TypeError(
  400. "'set dirName' called on an object that is not a valid instance of HTMLTextAreaElement."
  401. );
  402. }
  403. V = conversions["DOMString"](V, {
  404. context: "Failed to set the 'dirName' property on 'HTMLTextAreaElement': The provided value",
  405. globals: globalObject
  406. });
  407. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  408. try {
  409. esValue[implSymbol]._reflectSetTheContentAttribute("dirname", V);
  410. } finally {
  411. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  412. }
  413. }
  414. get disabled() {
  415. const esValue = this !== null && this !== undefined ? this : globalObject;
  416. if (!exports.is(esValue)) {
  417. throw new globalObject.TypeError(
  418. "'get disabled' called on an object that is not a valid instance of HTMLTextAreaElement."
  419. );
  420. }
  421. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  422. try {
  423. return esValue[implSymbol]._reflectGetTheContentAttribute("disabled") !== null;
  424. } finally {
  425. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  426. }
  427. }
  428. set disabled(V) {
  429. const esValue = this !== null && this !== undefined ? this : globalObject;
  430. if (!exports.is(esValue)) {
  431. throw new globalObject.TypeError(
  432. "'set disabled' called on an object that is not a valid instance of HTMLTextAreaElement."
  433. );
  434. }
  435. V = conversions["boolean"](V, {
  436. context: "Failed to set the 'disabled' property on 'HTMLTextAreaElement': The provided value",
  437. globals: globalObject
  438. });
  439. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  440. try {
  441. if (V) {
  442. esValue[implSymbol]._reflectSetTheContentAttribute("disabled", "");
  443. } else {
  444. esValue[implSymbol]._reflectDeleteTheContentAttribute("disabled");
  445. }
  446. } finally {
  447. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  448. }
  449. }
  450. get form() {
  451. const esValue = this !== null && this !== undefined ? this : globalObject;
  452. if (!exports.is(esValue)) {
  453. throw new globalObject.TypeError(
  454. "'get form' called on an object that is not a valid instance of HTMLTextAreaElement."
  455. );
  456. }
  457. return utils.tryWrapperForImpl(esValue[implSymbol]["form"]);
  458. }
  459. get inputMode() {
  460. const esValue = this !== null && this !== undefined ? this : globalObject;
  461. if (!exports.is(esValue)) {
  462. throw new globalObject.TypeError(
  463. "'get inputMode' called on an object that is not a valid instance of HTMLTextAreaElement."
  464. );
  465. }
  466. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  467. try {
  468. const value = esValue[implSymbol]._reflectGetTheContentAttribute("inputmode");
  469. return value === null ? "" : value;
  470. } finally {
  471. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  472. }
  473. }
  474. set inputMode(V) {
  475. const esValue = this !== null && this !== undefined ? this : globalObject;
  476. if (!exports.is(esValue)) {
  477. throw new globalObject.TypeError(
  478. "'set inputMode' called on an object that is not a valid instance of HTMLTextAreaElement."
  479. );
  480. }
  481. V = conversions["DOMString"](V, {
  482. context: "Failed to set the 'inputMode' property on 'HTMLTextAreaElement': The provided value",
  483. globals: globalObject
  484. });
  485. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  486. try {
  487. esValue[implSymbol]._reflectSetTheContentAttribute("inputmode", V);
  488. } finally {
  489. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  490. }
  491. }
  492. get maxLength() {
  493. const esValue = this !== null && this !== undefined ? this : globalObject;
  494. if (!exports.is(esValue)) {
  495. throw new globalObject.TypeError(
  496. "'get maxLength' called on an object that is not a valid instance of HTMLTextAreaElement."
  497. );
  498. }
  499. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  500. try {
  501. let value = esValue[implSymbol]._reflectGetTheContentAttribute("maxlength");
  502. if (value !== null) {
  503. value = parseNonNegativeInteger_jsdom_living_helpers_strings(value);
  504. if (value !== null && conversions.long(value) === value) {
  505. return value;
  506. }
  507. }
  508. return -1;
  509. } finally {
  510. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  511. }
  512. }
  513. set maxLength(V) {
  514. const esValue = this !== null && this !== undefined ? this : globalObject;
  515. if (!exports.is(esValue)) {
  516. throw new globalObject.TypeError(
  517. "'set maxLength' called on an object that is not a valid instance of HTMLTextAreaElement."
  518. );
  519. }
  520. V = conversions["long"](V, {
  521. context: "Failed to set the 'maxLength' property on 'HTMLTextAreaElement': The provided value",
  522. globals: globalObject
  523. });
  524. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  525. try {
  526. if (V < 0) {
  527. throw create_DOMException(globalObject, [
  528. `The negative value ${V} cannot be set for the maxLength property.`,
  529. "IndexSizeError"
  530. ]);
  531. }
  532. esValue[implSymbol]._reflectSetTheContentAttribute("maxlength", String(V));
  533. } finally {
  534. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  535. }
  536. }
  537. get minLength() {
  538. const esValue = this !== null && this !== undefined ? this : globalObject;
  539. if (!exports.is(esValue)) {
  540. throw new globalObject.TypeError(
  541. "'get minLength' called on an object that is not a valid instance of HTMLTextAreaElement."
  542. );
  543. }
  544. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  545. try {
  546. let value = esValue[implSymbol]._reflectGetTheContentAttribute("minlength");
  547. if (value !== null) {
  548. value = parseNonNegativeInteger_jsdom_living_helpers_strings(value);
  549. if (value !== null && conversions.long(value) === value) {
  550. return value;
  551. }
  552. }
  553. return -1;
  554. } finally {
  555. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  556. }
  557. }
  558. set minLength(V) {
  559. const esValue = this !== null && this !== undefined ? this : globalObject;
  560. if (!exports.is(esValue)) {
  561. throw new globalObject.TypeError(
  562. "'set minLength' called on an object that is not a valid instance of HTMLTextAreaElement."
  563. );
  564. }
  565. V = conversions["long"](V, {
  566. context: "Failed to set the 'minLength' property on 'HTMLTextAreaElement': The provided value",
  567. globals: globalObject
  568. });
  569. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  570. try {
  571. if (V < 0) {
  572. throw create_DOMException(globalObject, [
  573. `The negative value ${V} cannot be set for the minLength property.`,
  574. "IndexSizeError"
  575. ]);
  576. }
  577. esValue[implSymbol]._reflectSetTheContentAttribute("minlength", String(V));
  578. } finally {
  579. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  580. }
  581. }
  582. get name() {
  583. const esValue = this !== null && this !== undefined ? this : globalObject;
  584. if (!exports.is(esValue)) {
  585. throw new globalObject.TypeError(
  586. "'get name' called on an object that is not a valid instance of HTMLTextAreaElement."
  587. );
  588. }
  589. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  590. try {
  591. const value = esValue[implSymbol]._reflectGetTheContentAttribute("name");
  592. return value === null ? "" : value;
  593. } finally {
  594. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  595. }
  596. }
  597. set name(V) {
  598. const esValue = this !== null && this !== undefined ? this : globalObject;
  599. if (!exports.is(esValue)) {
  600. throw new globalObject.TypeError(
  601. "'set name' called on an object that is not a valid instance of HTMLTextAreaElement."
  602. );
  603. }
  604. V = conversions["DOMString"](V, {
  605. context: "Failed to set the 'name' property on 'HTMLTextAreaElement': The provided value",
  606. globals: globalObject
  607. });
  608. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  609. try {
  610. esValue[implSymbol]._reflectSetTheContentAttribute("name", V);
  611. } finally {
  612. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  613. }
  614. }
  615. get placeholder() {
  616. const esValue = this !== null && this !== undefined ? this : globalObject;
  617. if (!exports.is(esValue)) {
  618. throw new globalObject.TypeError(
  619. "'get placeholder' called on an object that is not a valid instance of HTMLTextAreaElement."
  620. );
  621. }
  622. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  623. try {
  624. const value = esValue[implSymbol]._reflectGetTheContentAttribute("placeholder");
  625. return value === null ? "" : value;
  626. } finally {
  627. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  628. }
  629. }
  630. set placeholder(V) {
  631. const esValue = this !== null && this !== undefined ? this : globalObject;
  632. if (!exports.is(esValue)) {
  633. throw new globalObject.TypeError(
  634. "'set placeholder' called on an object that is not a valid instance of HTMLTextAreaElement."
  635. );
  636. }
  637. V = conversions["DOMString"](V, {
  638. context: "Failed to set the 'placeholder' property on 'HTMLTextAreaElement': The provided value",
  639. globals: globalObject
  640. });
  641. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  642. try {
  643. esValue[implSymbol]._reflectSetTheContentAttribute("placeholder", V);
  644. } finally {
  645. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  646. }
  647. }
  648. get readOnly() {
  649. const esValue = this !== null && this !== undefined ? this : globalObject;
  650. if (!exports.is(esValue)) {
  651. throw new globalObject.TypeError(
  652. "'get readOnly' called on an object that is not a valid instance of HTMLTextAreaElement."
  653. );
  654. }
  655. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  656. try {
  657. return esValue[implSymbol]._reflectGetTheContentAttribute("readonly") !== null;
  658. } finally {
  659. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  660. }
  661. }
  662. set readOnly(V) {
  663. const esValue = this !== null && this !== undefined ? this : globalObject;
  664. if (!exports.is(esValue)) {
  665. throw new globalObject.TypeError(
  666. "'set readOnly' called on an object that is not a valid instance of HTMLTextAreaElement."
  667. );
  668. }
  669. V = conversions["boolean"](V, {
  670. context: "Failed to set the 'readOnly' property on 'HTMLTextAreaElement': The provided value",
  671. globals: globalObject
  672. });
  673. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  674. try {
  675. if (V) {
  676. esValue[implSymbol]._reflectSetTheContentAttribute("readonly", "");
  677. } else {
  678. esValue[implSymbol]._reflectDeleteTheContentAttribute("readonly");
  679. }
  680. } finally {
  681. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  682. }
  683. }
  684. get required() {
  685. const esValue = this !== null && this !== undefined ? this : globalObject;
  686. if (!exports.is(esValue)) {
  687. throw new globalObject.TypeError(
  688. "'get required' called on an object that is not a valid instance of HTMLTextAreaElement."
  689. );
  690. }
  691. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  692. try {
  693. return esValue[implSymbol]._reflectGetTheContentAttribute("required") !== null;
  694. } finally {
  695. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  696. }
  697. }
  698. set required(V) {
  699. const esValue = this !== null && this !== undefined ? this : globalObject;
  700. if (!exports.is(esValue)) {
  701. throw new globalObject.TypeError(
  702. "'set required' called on an object that is not a valid instance of HTMLTextAreaElement."
  703. );
  704. }
  705. V = conversions["boolean"](V, {
  706. context: "Failed to set the 'required' property on 'HTMLTextAreaElement': The provided value",
  707. globals: globalObject
  708. });
  709. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  710. try {
  711. if (V) {
  712. esValue[implSymbol]._reflectSetTheContentAttribute("required", "");
  713. } else {
  714. esValue[implSymbol]._reflectDeleteTheContentAttribute("required");
  715. }
  716. } finally {
  717. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  718. }
  719. }
  720. get rows() {
  721. const esValue = this !== null && this !== undefined ? this : globalObject;
  722. if (!exports.is(esValue)) {
  723. throw new globalObject.TypeError(
  724. "'get rows' called on an object that is not a valid instance of HTMLTextAreaElement."
  725. );
  726. }
  727. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  728. try {
  729. let value = esValue[implSymbol]._reflectGetTheContentAttribute("rows");
  730. if (value !== null) {
  731. value = parseNonNegativeInteger_jsdom_living_helpers_strings(value);
  732. if (value !== null && value >= 1 && value <= 2147483647) {
  733. return value;
  734. }
  735. }
  736. return 2;
  737. } finally {
  738. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  739. }
  740. }
  741. set rows(V) {
  742. const esValue = this !== null && this !== undefined ? this : globalObject;
  743. if (!exports.is(esValue)) {
  744. throw new globalObject.TypeError(
  745. "'set rows' called on an object that is not a valid instance of HTMLTextAreaElement."
  746. );
  747. }
  748. V = conversions["unsigned long"](V, {
  749. context: "Failed to set the 'rows' property on 'HTMLTextAreaElement': The provided value",
  750. globals: globalObject
  751. });
  752. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  753. try {
  754. const newValue = V <= 2147483647 && V >= 1 ? V : 2;
  755. esValue[implSymbol]._reflectSetTheContentAttribute("rows", String(newValue));
  756. } finally {
  757. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  758. }
  759. }
  760. get wrap() {
  761. const esValue = this !== null && this !== undefined ? this : globalObject;
  762. if (!exports.is(esValue)) {
  763. throw new globalObject.TypeError(
  764. "'get wrap' called on an object that is not a valid instance of HTMLTextAreaElement."
  765. );
  766. }
  767. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  768. try {
  769. const value = esValue[implSymbol]._reflectGetTheContentAttribute("wrap");
  770. return value === null ? "" : value;
  771. } finally {
  772. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  773. }
  774. }
  775. set wrap(V) {
  776. const esValue = this !== null && this !== undefined ? this : globalObject;
  777. if (!exports.is(esValue)) {
  778. throw new globalObject.TypeError(
  779. "'set wrap' called on an object that is not a valid instance of HTMLTextAreaElement."
  780. );
  781. }
  782. V = conversions["DOMString"](V, {
  783. context: "Failed to set the 'wrap' property on 'HTMLTextAreaElement': The provided value",
  784. globals: globalObject
  785. });
  786. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  787. try {
  788. esValue[implSymbol]._reflectSetTheContentAttribute("wrap", V);
  789. } finally {
  790. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  791. }
  792. }
  793. get type() {
  794. const esValue = this !== null && this !== undefined ? this : globalObject;
  795. if (!exports.is(esValue)) {
  796. throw new globalObject.TypeError(
  797. "'get type' called on an object that is not a valid instance of HTMLTextAreaElement."
  798. );
  799. }
  800. return esValue[implSymbol]["type"];
  801. }
  802. get defaultValue() {
  803. const esValue = this !== null && this !== undefined ? this : globalObject;
  804. if (!exports.is(esValue)) {
  805. throw new globalObject.TypeError(
  806. "'get defaultValue' called on an object that is not a valid instance of HTMLTextAreaElement."
  807. );
  808. }
  809. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  810. try {
  811. return esValue[implSymbol]["defaultValue"];
  812. } finally {
  813. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  814. }
  815. }
  816. set defaultValue(V) {
  817. const esValue = this !== null && this !== undefined ? this : globalObject;
  818. if (!exports.is(esValue)) {
  819. throw new globalObject.TypeError(
  820. "'set defaultValue' called on an object that is not a valid instance of HTMLTextAreaElement."
  821. );
  822. }
  823. V = conversions["DOMString"](V, {
  824. context: "Failed to set the 'defaultValue' property on 'HTMLTextAreaElement': The provided value",
  825. globals: globalObject
  826. });
  827. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  828. try {
  829. esValue[implSymbol]["defaultValue"] = V;
  830. } finally {
  831. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  832. }
  833. }
  834. get value() {
  835. const esValue = this !== null && this !== undefined ? this : globalObject;
  836. if (!exports.is(esValue)) {
  837. throw new globalObject.TypeError(
  838. "'get value' called on an object that is not a valid instance of HTMLTextAreaElement."
  839. );
  840. }
  841. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  842. try {
  843. return esValue[implSymbol]["value"];
  844. } finally {
  845. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  846. }
  847. }
  848. set value(V) {
  849. const esValue = this !== null && this !== undefined ? this : globalObject;
  850. if (!exports.is(esValue)) {
  851. throw new globalObject.TypeError(
  852. "'set value' called on an object that is not a valid instance of HTMLTextAreaElement."
  853. );
  854. }
  855. V = conversions["DOMString"](V, {
  856. context: "Failed to set the 'value' property on 'HTMLTextAreaElement': The provided value",
  857. globals: globalObject,
  858. treatNullAsEmptyString: true
  859. });
  860. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  861. try {
  862. esValue[implSymbol]["value"] = V;
  863. } finally {
  864. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  865. }
  866. }
  867. get textLength() {
  868. const esValue = this !== null && this !== undefined ? this : globalObject;
  869. if (!exports.is(esValue)) {
  870. throw new globalObject.TypeError(
  871. "'get textLength' called on an object that is not a valid instance of HTMLTextAreaElement."
  872. );
  873. }
  874. return esValue[implSymbol]["textLength"];
  875. }
  876. get willValidate() {
  877. const esValue = this !== null && this !== undefined ? this : globalObject;
  878. if (!exports.is(esValue)) {
  879. throw new globalObject.TypeError(
  880. "'get willValidate' called on an object that is not a valid instance of HTMLTextAreaElement."
  881. );
  882. }
  883. return esValue[implSymbol]["willValidate"];
  884. }
  885. get validity() {
  886. const esValue = this !== null && this !== undefined ? this : globalObject;
  887. if (!exports.is(esValue)) {
  888. throw new globalObject.TypeError(
  889. "'get validity' called on an object that is not a valid instance of HTMLTextAreaElement."
  890. );
  891. }
  892. return utils.tryWrapperForImpl(esValue[implSymbol]["validity"]);
  893. }
  894. get validationMessage() {
  895. const esValue = this !== null && this !== undefined ? this : globalObject;
  896. if (!exports.is(esValue)) {
  897. throw new globalObject.TypeError(
  898. "'get validationMessage' called on an object that is not a valid instance of HTMLTextAreaElement."
  899. );
  900. }
  901. return esValue[implSymbol]["validationMessage"];
  902. }
  903. get labels() {
  904. const esValue = this !== null && this !== undefined ? this : globalObject;
  905. if (!exports.is(esValue)) {
  906. throw new globalObject.TypeError(
  907. "'get labels' called on an object that is not a valid instance of HTMLTextAreaElement."
  908. );
  909. }
  910. return utils.tryWrapperForImpl(esValue[implSymbol]["labels"]);
  911. }
  912. get selectionStart() {
  913. const esValue = this !== null && this !== undefined ? this : globalObject;
  914. if (!exports.is(esValue)) {
  915. throw new globalObject.TypeError(
  916. "'get selectionStart' called on an object that is not a valid instance of HTMLTextAreaElement."
  917. );
  918. }
  919. return esValue[implSymbol]["selectionStart"];
  920. }
  921. set selectionStart(V) {
  922. const esValue = this !== null && this !== undefined ? this : globalObject;
  923. if (!exports.is(esValue)) {
  924. throw new globalObject.TypeError(
  925. "'set selectionStart' called on an object that is not a valid instance of HTMLTextAreaElement."
  926. );
  927. }
  928. V = conversions["unsigned long"](V, {
  929. context: "Failed to set the 'selectionStart' property on 'HTMLTextAreaElement': The provided value",
  930. globals: globalObject
  931. });
  932. esValue[implSymbol]["selectionStart"] = V;
  933. }
  934. get selectionEnd() {
  935. const esValue = this !== null && this !== undefined ? this : globalObject;
  936. if (!exports.is(esValue)) {
  937. throw new globalObject.TypeError(
  938. "'get selectionEnd' called on an object that is not a valid instance of HTMLTextAreaElement."
  939. );
  940. }
  941. return esValue[implSymbol]["selectionEnd"];
  942. }
  943. set selectionEnd(V) {
  944. const esValue = this !== null && this !== undefined ? this : globalObject;
  945. if (!exports.is(esValue)) {
  946. throw new globalObject.TypeError(
  947. "'set selectionEnd' called on an object that is not a valid instance of HTMLTextAreaElement."
  948. );
  949. }
  950. V = conversions["unsigned long"](V, {
  951. context: "Failed to set the 'selectionEnd' property on 'HTMLTextAreaElement': The provided value",
  952. globals: globalObject
  953. });
  954. esValue[implSymbol]["selectionEnd"] = V;
  955. }
  956. get selectionDirection() {
  957. const esValue = this !== null && this !== undefined ? this : globalObject;
  958. if (!exports.is(esValue)) {
  959. throw new globalObject.TypeError(
  960. "'get selectionDirection' called on an object that is not a valid instance of HTMLTextAreaElement."
  961. );
  962. }
  963. return esValue[implSymbol]["selectionDirection"];
  964. }
  965. set selectionDirection(V) {
  966. const esValue = this !== null && this !== undefined ? this : globalObject;
  967. if (!exports.is(esValue)) {
  968. throw new globalObject.TypeError(
  969. "'set selectionDirection' called on an object that is not a valid instance of HTMLTextAreaElement."
  970. );
  971. }
  972. V = conversions["DOMString"](V, {
  973. context: "Failed to set the 'selectionDirection' property on 'HTMLTextAreaElement': The provided value",
  974. globals: globalObject
  975. });
  976. esValue[implSymbol]["selectionDirection"] = V;
  977. }
  978. }
  979. Object.defineProperties(HTMLTextAreaElement.prototype, {
  980. checkValidity: { enumerable: true },
  981. reportValidity: { enumerable: true },
  982. setCustomValidity: { enumerable: true },
  983. select: { enumerable: true },
  984. setRangeText: { enumerable: true },
  985. setSelectionRange: { enumerable: true },
  986. autocomplete: { enumerable: true },
  987. autofocus: { enumerable: true },
  988. cols: { enumerable: true },
  989. dirName: { enumerable: true },
  990. disabled: { enumerable: true },
  991. form: { enumerable: true },
  992. inputMode: { enumerable: true },
  993. maxLength: { enumerable: true },
  994. minLength: { enumerable: true },
  995. name: { enumerable: true },
  996. placeholder: { enumerable: true },
  997. readOnly: { enumerable: true },
  998. required: { enumerable: true },
  999. rows: { enumerable: true },
  1000. wrap: { enumerable: true },
  1001. type: { enumerable: true },
  1002. defaultValue: { enumerable: true },
  1003. value: { enumerable: true },
  1004. textLength: { enumerable: true },
  1005. willValidate: { enumerable: true },
  1006. validity: { enumerable: true },
  1007. validationMessage: { enumerable: true },
  1008. labels: { enumerable: true },
  1009. selectionStart: { enumerable: true },
  1010. selectionEnd: { enumerable: true },
  1011. selectionDirection: { enumerable: true },
  1012. [Symbol.toStringTag]: { value: "HTMLTextAreaElement", configurable: true }
  1013. });
  1014. ctorRegistry[interfaceName] = HTMLTextAreaElement;
  1015. Object.defineProperty(globalObject, interfaceName, {
  1016. configurable: true,
  1017. writable: true,
  1018. value: HTMLTextAreaElement
  1019. });
  1020. };
  1021. const Impl = require("../../jsdom/living/nodes/HTMLTextAreaElement-impl.js");