/ cloudformation-templates / node_modules / jsdom / lib / jsdom / living / generated / HTMLMetaElement.js
HTMLMetaElement.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 = "HTMLMetaElement"; 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 'HTMLMetaElement'.`); 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]["HTMLMetaElement"]; 34 if (ctor === undefined) { 35 throw new Error("Internal error: constructor HTMLMetaElement 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 HTMLMetaElement before HTMLElement"); 96 } 97 class HTMLMetaElement extends globalObject.HTMLElement { 98 constructor() { 99 return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target); 100 } 101 102 get name() { 103 const esValue = this !== null && this !== undefined ? this : globalObject; 104 105 if (!exports.is(esValue)) { 106 throw new TypeError("'get name' called on an object that is not a valid instance of HTMLMetaElement."); 107 } 108 109 ceReactionsPreSteps_helpers_custom_elements(globalObject); 110 try { 111 const value = esValue[implSymbol].getAttributeNS(null, "name"); 112 return value === null ? "" : value; 113 } finally { 114 ceReactionsPostSteps_helpers_custom_elements(globalObject); 115 } 116 } 117 118 set name(V) { 119 const esValue = this !== null && this !== undefined ? this : globalObject; 120 121 if (!exports.is(esValue)) { 122 throw new TypeError("'set name' called on an object that is not a valid instance of HTMLMetaElement."); 123 } 124 125 V = conversions["DOMString"](V, { 126 context: "Failed to set the 'name' property on 'HTMLMetaElement': The provided value" 127 }); 128 129 ceReactionsPreSteps_helpers_custom_elements(globalObject); 130 try { 131 esValue[implSymbol].setAttributeNS(null, "name", V); 132 } finally { 133 ceReactionsPostSteps_helpers_custom_elements(globalObject); 134 } 135 } 136 137 get httpEquiv() { 138 const esValue = this !== null && this !== undefined ? this : globalObject; 139 140 if (!exports.is(esValue)) { 141 throw new TypeError("'get httpEquiv' called on an object that is not a valid instance of HTMLMetaElement."); 142 } 143 144 ceReactionsPreSteps_helpers_custom_elements(globalObject); 145 try { 146 const value = esValue[implSymbol].getAttributeNS(null, "http-equiv"); 147 return value === null ? "" : value; 148 } finally { 149 ceReactionsPostSteps_helpers_custom_elements(globalObject); 150 } 151 } 152 153 set httpEquiv(V) { 154 const esValue = this !== null && this !== undefined ? this : globalObject; 155 156 if (!exports.is(esValue)) { 157 throw new TypeError("'set httpEquiv' called on an object that is not a valid instance of HTMLMetaElement."); 158 } 159 160 V = conversions["DOMString"](V, { 161 context: "Failed to set the 'httpEquiv' property on 'HTMLMetaElement': The provided value" 162 }); 163 164 ceReactionsPreSteps_helpers_custom_elements(globalObject); 165 try { 166 esValue[implSymbol].setAttributeNS(null, "http-equiv", V); 167 } finally { 168 ceReactionsPostSteps_helpers_custom_elements(globalObject); 169 } 170 } 171 172 get content() { 173 const esValue = this !== null && this !== undefined ? this : globalObject; 174 175 if (!exports.is(esValue)) { 176 throw new TypeError("'get content' called on an object that is not a valid instance of HTMLMetaElement."); 177 } 178 179 ceReactionsPreSteps_helpers_custom_elements(globalObject); 180 try { 181 const value = esValue[implSymbol].getAttributeNS(null, "content"); 182 return value === null ? "" : value; 183 } finally { 184 ceReactionsPostSteps_helpers_custom_elements(globalObject); 185 } 186 } 187 188 set content(V) { 189 const esValue = this !== null && this !== undefined ? this : globalObject; 190 191 if (!exports.is(esValue)) { 192 throw new TypeError("'set content' called on an object that is not a valid instance of HTMLMetaElement."); 193 } 194 195 V = conversions["DOMString"](V, { 196 context: "Failed to set the 'content' property on 'HTMLMetaElement': The provided value" 197 }); 198 199 ceReactionsPreSteps_helpers_custom_elements(globalObject); 200 try { 201 esValue[implSymbol].setAttributeNS(null, "content", V); 202 } finally { 203 ceReactionsPostSteps_helpers_custom_elements(globalObject); 204 } 205 } 206 207 get scheme() { 208 const esValue = this !== null && this !== undefined ? this : globalObject; 209 210 if (!exports.is(esValue)) { 211 throw new TypeError("'get scheme' called on an object that is not a valid instance of HTMLMetaElement."); 212 } 213 214 ceReactionsPreSteps_helpers_custom_elements(globalObject); 215 try { 216 const value = esValue[implSymbol].getAttributeNS(null, "scheme"); 217 return value === null ? "" : value; 218 } finally { 219 ceReactionsPostSteps_helpers_custom_elements(globalObject); 220 } 221 } 222 223 set scheme(V) { 224 const esValue = this !== null && this !== undefined ? this : globalObject; 225 226 if (!exports.is(esValue)) { 227 throw new TypeError("'set scheme' called on an object that is not a valid instance of HTMLMetaElement."); 228 } 229 230 V = conversions["DOMString"](V, { 231 context: "Failed to set the 'scheme' property on 'HTMLMetaElement': The provided value" 232 }); 233 234 ceReactionsPreSteps_helpers_custom_elements(globalObject); 235 try { 236 esValue[implSymbol].setAttributeNS(null, "scheme", V); 237 } finally { 238 ceReactionsPostSteps_helpers_custom_elements(globalObject); 239 } 240 } 241 } 242 Object.defineProperties(HTMLMetaElement.prototype, { 243 name: { enumerable: true }, 244 httpEquiv: { enumerable: true }, 245 content: { enumerable: true }, 246 scheme: { enumerable: true }, 247 [Symbol.toStringTag]: { value: "HTMLMetaElement", configurable: true } 248 }); 249 if (globalObject[ctorRegistrySymbol] === undefined) { 250 globalObject[ctorRegistrySymbol] = Object.create(null); 251 } 252 globalObject[ctorRegistrySymbol][interfaceName] = HTMLMetaElement; 253 254 Object.defineProperty(globalObject, interfaceName, { 255 configurable: true, 256 writable: true, 257 value: HTMLMetaElement 258 }); 259 }; 260 261 const Impl = require("../nodes/HTMLMetaElement-impl.js");