/ cloudformation-templates / node_modules / jsdom / lib / jsdom / living / generated / HTMLDirectoryElement.js
HTMLDirectoryElement.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 ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; 8 const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; 9 const implSymbol = utils.implSymbol; 10 const ctorRegistrySymbol = utils.ctorRegistrySymbol; 11 const HTMLElement = require("./HTMLElement.js"); 12 13 const interfaceName = "HTMLDirectoryElement"; 14 15 exports.is = value => { 16 return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; 17 }; 18 exports.isImpl = value => { 19 return utils.isObject(value) && value instanceof Impl.implementation; 20 }; 21 exports.convert = (value, { context = "The provided value" } = {}) => { 22 if (exports.is(value)) { 23 return utils.implForWrapper(value); 24 } 25 throw new TypeError(`${context} is not of type 'HTMLDirectoryElement'.`); 26 }; 27 28 function makeWrapper(globalObject) { 29 if (globalObject[ctorRegistrySymbol] === undefined) { 30 throw new Error("Internal error: invalid global object"); 31 } 32 33 const ctor = globalObject[ctorRegistrySymbol]["HTMLDirectoryElement"]; 34 if (ctor === undefined) { 35 throw new Error("Internal error: constructor HTMLDirectoryElement is not installed on the passed global object"); 36 } 37 38 return Object.create(ctor.prototype); 39 } 40 41 exports.create = (globalObject, constructorArgs, privateData) => { 42 const wrapper = makeWrapper(globalObject); 43 return exports.setup(wrapper, globalObject, constructorArgs, privateData); 44 }; 45 46 exports.createImpl = (globalObject, constructorArgs, privateData) => { 47 const wrapper = exports.create(globalObject, constructorArgs, privateData); 48 return utils.implForWrapper(wrapper); 49 }; 50 51 exports._internalSetup = (wrapper, globalObject) => { 52 HTMLElement._internalSetup(wrapper, globalObject); 53 }; 54 55 exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { 56 privateData.wrapper = wrapper; 57 58 exports._internalSetup(wrapper, globalObject); 59 Object.defineProperty(wrapper, implSymbol, { 60 value: new Impl.implementation(globalObject, constructorArgs, privateData), 61 configurable: true 62 }); 63 64 wrapper[implSymbol][utils.wrapperSymbol] = wrapper; 65 if (Impl.init) { 66 Impl.init(wrapper[implSymbol]); 67 } 68 return wrapper; 69 }; 70 71 exports.new = globalObject => { 72 const wrapper = makeWrapper(globalObject); 73 74 exports._internalSetup(wrapper, globalObject); 75 Object.defineProperty(wrapper, implSymbol, { 76 value: Object.create(Impl.implementation.prototype), 77 configurable: true 78 }); 79 80 wrapper[implSymbol][utils.wrapperSymbol] = wrapper; 81 if (Impl.init) { 82 Impl.init(wrapper[implSymbol]); 83 } 84 return wrapper[implSymbol]; 85 }; 86 87 const exposed = new Set(["Window"]); 88 89 exports.install = (globalObject, globalNames) => { 90 if (!globalNames.some(globalName => exposed.has(globalName))) { 91 return; 92 } 93 94 if (globalObject.HTMLElement === undefined) { 95 throw new Error("Internal error: attempting to evaluate HTMLDirectoryElement before HTMLElement"); 96 } 97 class HTMLDirectoryElement extends globalObject.HTMLElement { 98 constructor() { 99 return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); 100 } 101 102 get compact() { 103 const esValue = this !== null && this !== undefined ? this : globalObject; 104 105 if (!exports.is(esValue)) { 106 throw new TypeError("'get compact' called on an object that is not a valid instance of HTMLDirectoryElement."); 107 } 108 109 ceReactionsPreSteps_helpers_custom_elements(globalObject); 110 try { 111 return esValue[implSymbol].hasAttributeNS(null, "compact"); 112 } finally { 113 ceReactionsPostSteps_helpers_custom_elements(globalObject); 114 } 115 } 116 117 set compact(V) { 118 const esValue = this !== null && this !== undefined ? this : globalObject; 119 120 if (!exports.is(esValue)) { 121 throw new TypeError("'set compact' called on an object that is not a valid instance of HTMLDirectoryElement."); 122 } 123 124 V = conversions["boolean"](V, { 125 context: "Failed to set the 'compact' property on 'HTMLDirectoryElement': The provided value" 126 }); 127 128 ceReactionsPreSteps_helpers_custom_elements(globalObject); 129 try { 130 if (V) { 131 esValue[implSymbol].setAttributeNS(null, "compact", ""); 132 } else { 133 esValue[implSymbol].removeAttributeNS(null, "compact"); 134 } 135 } finally { 136 ceReactionsPostSteps_helpers_custom_elements(globalObject); 137 } 138 } 139 } 140 Object.defineProperties(HTMLDirectoryElement.prototype, { 141 compact: { enumerable: true }, 142 [Symbol.toStringTag]: { value: "HTMLDirectoryElement", configurable: true } 143 }); 144 if (globalObject[ctorRegistrySymbol] === undefined) { 145 globalObject[ctorRegistrySymbol] = Object.create(null); 146 } 147 globalObject[ctorRegistrySymbol][interfaceName] = HTMLDirectoryElement; 148 149 Object.defineProperty(globalObject, interfaceName, { 150 configurable: true, 151 writable: true, 152 value: HTMLDirectoryElement 153 }); 154 }; 155 156 const Impl = require("../nodes/HTMLDirectoryElement-impl.js");