/ cloudformation-templates / node_modules / jsdom / lib / jsdom / living / generated / HTMLProgressElement.js
HTMLProgressElement.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 = "HTMLProgressElement"; 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 'HTMLProgressElement'.`); 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]["HTMLProgressElement"]; 34 if (ctor === undefined) { 35 throw new Error("Internal error: constructor HTMLProgressElement 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 HTMLProgressElement before HTMLElement"); 96 } 97 class HTMLProgressElement extends globalObject.HTMLElement { 98 constructor() { 99 return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); 100 } 101 102 get value() { 103 const esValue = this !== null && this !== undefined ? this : globalObject; 104 105 if (!exports.is(esValue)) { 106 throw new TypeError("'get value' called on an object that is not a valid instance of HTMLProgressElement."); 107 } 108 109 ceReactionsPreSteps_helpers_custom_elements(globalObject); 110 try { 111 return esValue[implSymbol]["value"]; 112 } finally { 113 ceReactionsPostSteps_helpers_custom_elements(globalObject); 114 } 115 } 116 117 set value(V) { 118 const esValue = this !== null && this !== undefined ? this : globalObject; 119 120 if (!exports.is(esValue)) { 121 throw new TypeError("'set value' called on an object that is not a valid instance of HTMLProgressElement."); 122 } 123 124 V = conversions["double"](V, { 125 context: "Failed to set the 'value' property on 'HTMLProgressElement': The provided value" 126 }); 127 128 ceReactionsPreSteps_helpers_custom_elements(globalObject); 129 try { 130 esValue[implSymbol]["value"] = V; 131 } finally { 132 ceReactionsPostSteps_helpers_custom_elements(globalObject); 133 } 134 } 135 136 get max() { 137 const esValue = this !== null && this !== undefined ? this : globalObject; 138 139 if (!exports.is(esValue)) { 140 throw new TypeError("'get max' called on an object that is not a valid instance of HTMLProgressElement."); 141 } 142 143 ceReactionsPreSteps_helpers_custom_elements(globalObject); 144 try { 145 return esValue[implSymbol]["max"]; 146 } finally { 147 ceReactionsPostSteps_helpers_custom_elements(globalObject); 148 } 149 } 150 151 set max(V) { 152 const esValue = this !== null && this !== undefined ? this : globalObject; 153 154 if (!exports.is(esValue)) { 155 throw new TypeError("'set max' called on an object that is not a valid instance of HTMLProgressElement."); 156 } 157 158 V = conversions["double"](V, { 159 context: "Failed to set the 'max' property on 'HTMLProgressElement': The provided value" 160 }); 161 162 ceReactionsPreSteps_helpers_custom_elements(globalObject); 163 try { 164 esValue[implSymbol]["max"] = V; 165 } finally { 166 ceReactionsPostSteps_helpers_custom_elements(globalObject); 167 } 168 } 169 170 get position() { 171 const esValue = this !== null && this !== undefined ? this : globalObject; 172 173 if (!exports.is(esValue)) { 174 throw new TypeError("'get position' called on an object that is not a valid instance of HTMLProgressElement."); 175 } 176 177 return esValue[implSymbol]["position"]; 178 } 179 180 get labels() { 181 const esValue = this !== null && this !== undefined ? this : globalObject; 182 183 if (!exports.is(esValue)) { 184 throw new TypeError("'get labels' called on an object that is not a valid instance of HTMLProgressElement."); 185 } 186 187 return utils.tryWrapperForImpl(esValue[implSymbol]["labels"]); 188 } 189 } 190 Object.defineProperties(HTMLProgressElement.prototype, { 191 value: { enumerable: true }, 192 max: { enumerable: true }, 193 position: { enumerable: true }, 194 labels: { enumerable: true }, 195 [Symbol.toStringTag]: { value: "HTMLProgressElement", configurable: true } 196 }); 197 if (globalObject[ctorRegistrySymbol] === undefined) { 198 globalObject[ctorRegistrySymbol] = Object.create(null); 199 } 200 globalObject[ctorRegistrySymbol][interfaceName] = HTMLProgressElement; 201 202 Object.defineProperty(globalObject, interfaceName, { 203 configurable: true, 204 writable: true, 205 value: HTMLProgressElement 206 }); 207 }; 208 209 const Impl = require("../nodes/HTMLProgressElement-impl.js");