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