HTMLObjectElement.js 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945
  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 serializeURLwhatwg_url = require("whatwg-url").serializeURL;
  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 implSymbol = utils.implSymbol;
  14. const ctorRegistrySymbol = utils.ctorRegistrySymbol;
  15. const HTMLElement = require("./HTMLElement.js");
  16. const interfaceName = "HTMLObjectElement";
  17. exports.is = value => {
  18. return utils.isObject(value) && Object.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation;
  19. };
  20. exports.isImpl = value => {
  21. return utils.isObject(value) && value instanceof Impl.implementation;
  22. };
  23. exports.convert = (globalObject, value, { context = "The provided value" } = {}) => {
  24. if (exports.is(value)) {
  25. return utils.implForWrapper(value);
  26. }
  27. throw new globalObject.TypeError(`${context} is not of type 'HTMLObjectElement'.`);
  28. };
  29. function makeWrapper(globalObject, newTarget) {
  30. let proto;
  31. if (newTarget !== undefined) {
  32. proto = newTarget.prototype;
  33. }
  34. if (!utils.isObject(proto)) {
  35. proto = globalObject[ctorRegistrySymbol]["HTMLObjectElement"].prototype;
  36. }
  37. return Object.create(proto);
  38. }
  39. exports.create = (globalObject, constructorArgs, privateData) => {
  40. const wrapper = makeWrapper(globalObject);
  41. return exports.setup(wrapper, globalObject, constructorArgs, privateData);
  42. };
  43. exports.createImpl = (globalObject, constructorArgs, privateData) => {
  44. const wrapper = exports.create(globalObject, constructorArgs, privateData);
  45. return utils.implForWrapper(wrapper);
  46. };
  47. exports._internalSetup = (wrapper, globalObject) => {
  48. HTMLElement._internalSetup(wrapper, globalObject);
  49. };
  50. exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => {
  51. privateData.wrapper = wrapper;
  52. exports._internalSetup(wrapper, globalObject);
  53. Object.defineProperty(wrapper, implSymbol, {
  54. value: new Impl.implementation(globalObject, constructorArgs, privateData),
  55. configurable: true
  56. });
  57. wrapper[implSymbol][utils.wrapperSymbol] = wrapper;
  58. if (Impl.init) {
  59. Impl.init(wrapper[implSymbol]);
  60. }
  61. return wrapper;
  62. };
  63. exports.new = (globalObject, newTarget) => {
  64. const wrapper = makeWrapper(globalObject, newTarget);
  65. exports._internalSetup(wrapper, globalObject);
  66. Object.defineProperty(wrapper, implSymbol, {
  67. value: Object.create(Impl.implementation.prototype),
  68. configurable: true
  69. });
  70. wrapper[implSymbol][utils.wrapperSymbol] = wrapper;
  71. if (Impl.init) {
  72. Impl.init(wrapper[implSymbol]);
  73. }
  74. return wrapper[implSymbol];
  75. };
  76. const exposed = new Set(["Window"]);
  77. exports.install = (globalObject, globalNames) => {
  78. if (!globalNames.some(globalName => exposed.has(globalName))) {
  79. return;
  80. }
  81. const ctorRegistry = utils.initCtorRegistry(globalObject);
  82. class HTMLObjectElement extends globalObject.HTMLElement {
  83. constructor() {
  84. return HTMLConstructor_jsdom_living_helpers_html_constructor(globalObject, interfaceName, new.target);
  85. }
  86. checkValidity() {
  87. const esValue = this !== null && this !== undefined ? this : globalObject;
  88. if (!exports.is(esValue)) {
  89. throw new globalObject.TypeError(
  90. "'checkValidity' called on an object that is not a valid instance of HTMLObjectElement."
  91. );
  92. }
  93. return esValue[implSymbol].checkValidity();
  94. }
  95. reportValidity() {
  96. const esValue = this !== null && this !== undefined ? this : globalObject;
  97. if (!exports.is(esValue)) {
  98. throw new globalObject.TypeError(
  99. "'reportValidity' called on an object that is not a valid instance of HTMLObjectElement."
  100. );
  101. }
  102. return esValue[implSymbol].reportValidity();
  103. }
  104. setCustomValidity(error) {
  105. const esValue = this !== null && this !== undefined ? this : globalObject;
  106. if (!exports.is(esValue)) {
  107. throw new globalObject.TypeError(
  108. "'setCustomValidity' called on an object that is not a valid instance of HTMLObjectElement."
  109. );
  110. }
  111. if (arguments.length < 1) {
  112. throw new globalObject.TypeError(
  113. `Failed to execute 'setCustomValidity' on 'HTMLObjectElement': 1 argument required, but only ${arguments.length} present.`
  114. );
  115. }
  116. const args = [];
  117. {
  118. let curArg = arguments[0];
  119. curArg = conversions["DOMString"](curArg, {
  120. context: "Failed to execute 'setCustomValidity' on 'HTMLObjectElement': parameter 1",
  121. globals: globalObject
  122. });
  123. args.push(curArg);
  124. }
  125. return esValue[implSymbol].setCustomValidity(...args);
  126. }
  127. get data() {
  128. const esValue = this !== null && this !== undefined ? this : globalObject;
  129. if (!exports.is(esValue)) {
  130. throw new globalObject.TypeError(
  131. "'get data' called on an object that is not a valid instance of HTMLObjectElement."
  132. );
  133. }
  134. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  135. try {
  136. const impl = esValue[implSymbol];
  137. const value = impl._reflectGetTheContentAttribute("data");
  138. if (value === null) {
  139. return "";
  140. }
  141. const document = impl._ownerDocument;
  142. if (this._dataURLCacheKey === value && this._baseURLCache === document._baseURLCache) {
  143. return this._dataURLCache;
  144. }
  145. this._dataURLCacheKey = value;
  146. this._baseURLCache = document._baseURLCache;
  147. const urlRecord = document.encodingParseAURL(value);
  148. if (urlRecord !== null) {
  149. this._dataURLCache = serializeURLwhatwg_url(urlRecord);
  150. return this._dataURLCache;
  151. }
  152. this._dataURLCache = conversions.USVString(value);
  153. return this._dataURLCache;
  154. } finally {
  155. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  156. }
  157. }
  158. set data(V) {
  159. const esValue = this !== null && this !== undefined ? this : globalObject;
  160. if (!exports.is(esValue)) {
  161. throw new globalObject.TypeError(
  162. "'set data' called on an object that is not a valid instance of HTMLObjectElement."
  163. );
  164. }
  165. V = conversions["USVString"](V, {
  166. context: "Failed to set the 'data' property on 'HTMLObjectElement': The provided value",
  167. globals: globalObject
  168. });
  169. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  170. try {
  171. esValue[implSymbol]._reflectSetTheContentAttribute("data", V);
  172. } finally {
  173. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  174. }
  175. }
  176. get type() {
  177. const esValue = this !== null && this !== undefined ? this : globalObject;
  178. if (!exports.is(esValue)) {
  179. throw new globalObject.TypeError(
  180. "'get type' called on an object that is not a valid instance of HTMLObjectElement."
  181. );
  182. }
  183. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  184. try {
  185. const value = esValue[implSymbol]._reflectGetTheContentAttribute("type");
  186. return value === null ? "" : value;
  187. } finally {
  188. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  189. }
  190. }
  191. set type(V) {
  192. const esValue = this !== null && this !== undefined ? this : globalObject;
  193. if (!exports.is(esValue)) {
  194. throw new globalObject.TypeError(
  195. "'set type' called on an object that is not a valid instance of HTMLObjectElement."
  196. );
  197. }
  198. V = conversions["DOMString"](V, {
  199. context: "Failed to set the 'type' property on 'HTMLObjectElement': The provided value",
  200. globals: globalObject
  201. });
  202. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  203. try {
  204. esValue[implSymbol]._reflectSetTheContentAttribute("type", V);
  205. } finally {
  206. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  207. }
  208. }
  209. get name() {
  210. const esValue = this !== null && this !== undefined ? this : globalObject;
  211. if (!exports.is(esValue)) {
  212. throw new globalObject.TypeError(
  213. "'get name' called on an object that is not a valid instance of HTMLObjectElement."
  214. );
  215. }
  216. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  217. try {
  218. const value = esValue[implSymbol]._reflectGetTheContentAttribute("name");
  219. return value === null ? "" : value;
  220. } finally {
  221. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  222. }
  223. }
  224. set name(V) {
  225. const esValue = this !== null && this !== undefined ? this : globalObject;
  226. if (!exports.is(esValue)) {
  227. throw new globalObject.TypeError(
  228. "'set name' called on an object that is not a valid instance of HTMLObjectElement."
  229. );
  230. }
  231. V = conversions["DOMString"](V, {
  232. context: "Failed to set the 'name' property on 'HTMLObjectElement': The provided value",
  233. globals: globalObject
  234. });
  235. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  236. try {
  237. esValue[implSymbol]._reflectSetTheContentAttribute("name", V);
  238. } finally {
  239. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  240. }
  241. }
  242. get useMap() {
  243. const esValue = this !== null && this !== undefined ? this : globalObject;
  244. if (!exports.is(esValue)) {
  245. throw new globalObject.TypeError(
  246. "'get useMap' called on an object that is not a valid instance of HTMLObjectElement."
  247. );
  248. }
  249. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  250. try {
  251. const value = esValue[implSymbol]._reflectGetTheContentAttribute("usemap");
  252. return value === null ? "" : value;
  253. } finally {
  254. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  255. }
  256. }
  257. set useMap(V) {
  258. const esValue = this !== null && this !== undefined ? this : globalObject;
  259. if (!exports.is(esValue)) {
  260. throw new globalObject.TypeError(
  261. "'set useMap' called on an object that is not a valid instance of HTMLObjectElement."
  262. );
  263. }
  264. V = conversions["DOMString"](V, {
  265. context: "Failed to set the 'useMap' property on 'HTMLObjectElement': The provided value",
  266. globals: globalObject
  267. });
  268. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  269. try {
  270. esValue[implSymbol]._reflectSetTheContentAttribute("usemap", V);
  271. } finally {
  272. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  273. }
  274. }
  275. get form() {
  276. const esValue = this !== null && this !== undefined ? this : globalObject;
  277. if (!exports.is(esValue)) {
  278. throw new globalObject.TypeError(
  279. "'get form' called on an object that is not a valid instance of HTMLObjectElement."
  280. );
  281. }
  282. return utils.tryWrapperForImpl(esValue[implSymbol]["form"]);
  283. }
  284. get width() {
  285. const esValue = this !== null && this !== undefined ? this : globalObject;
  286. if (!exports.is(esValue)) {
  287. throw new globalObject.TypeError(
  288. "'get width' called on an object that is not a valid instance of HTMLObjectElement."
  289. );
  290. }
  291. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  292. try {
  293. const value = esValue[implSymbol]._reflectGetTheContentAttribute("width");
  294. return value === null ? "" : value;
  295. } finally {
  296. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  297. }
  298. }
  299. set width(V) {
  300. const esValue = this !== null && this !== undefined ? this : globalObject;
  301. if (!exports.is(esValue)) {
  302. throw new globalObject.TypeError(
  303. "'set width' called on an object that is not a valid instance of HTMLObjectElement."
  304. );
  305. }
  306. V = conversions["DOMString"](V, {
  307. context: "Failed to set the 'width' property on 'HTMLObjectElement': The provided value",
  308. globals: globalObject
  309. });
  310. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  311. try {
  312. esValue[implSymbol]._reflectSetTheContentAttribute("width", V);
  313. } finally {
  314. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  315. }
  316. }
  317. get height() {
  318. const esValue = this !== null && this !== undefined ? this : globalObject;
  319. if (!exports.is(esValue)) {
  320. throw new globalObject.TypeError(
  321. "'get height' called on an object that is not a valid instance of HTMLObjectElement."
  322. );
  323. }
  324. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  325. try {
  326. const value = esValue[implSymbol]._reflectGetTheContentAttribute("height");
  327. return value === null ? "" : value;
  328. } finally {
  329. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  330. }
  331. }
  332. set height(V) {
  333. const esValue = this !== null && this !== undefined ? this : globalObject;
  334. if (!exports.is(esValue)) {
  335. throw new globalObject.TypeError(
  336. "'set height' called on an object that is not a valid instance of HTMLObjectElement."
  337. );
  338. }
  339. V = conversions["DOMString"](V, {
  340. context: "Failed to set the 'height' property on 'HTMLObjectElement': The provided value",
  341. globals: globalObject
  342. });
  343. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  344. try {
  345. esValue[implSymbol]._reflectSetTheContentAttribute("height", V);
  346. } finally {
  347. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  348. }
  349. }
  350. get contentDocument() {
  351. const esValue = this !== null && this !== undefined ? this : globalObject;
  352. if (!exports.is(esValue)) {
  353. throw new globalObject.TypeError(
  354. "'get contentDocument' called on an object that is not a valid instance of HTMLObjectElement."
  355. );
  356. }
  357. return utils.tryWrapperForImpl(esValue[implSymbol]["contentDocument"]);
  358. }
  359. get willValidate() {
  360. const esValue = this !== null && this !== undefined ? this : globalObject;
  361. if (!exports.is(esValue)) {
  362. throw new globalObject.TypeError(
  363. "'get willValidate' called on an object that is not a valid instance of HTMLObjectElement."
  364. );
  365. }
  366. return esValue[implSymbol]["willValidate"];
  367. }
  368. get validity() {
  369. const esValue = this !== null && this !== undefined ? this : globalObject;
  370. if (!exports.is(esValue)) {
  371. throw new globalObject.TypeError(
  372. "'get validity' called on an object that is not a valid instance of HTMLObjectElement."
  373. );
  374. }
  375. return utils.tryWrapperForImpl(esValue[implSymbol]["validity"]);
  376. }
  377. get validationMessage() {
  378. const esValue = this !== null && this !== undefined ? this : globalObject;
  379. if (!exports.is(esValue)) {
  380. throw new globalObject.TypeError(
  381. "'get validationMessage' called on an object that is not a valid instance of HTMLObjectElement."
  382. );
  383. }
  384. return esValue[implSymbol]["validationMessage"];
  385. }
  386. get align() {
  387. const esValue = this !== null && this !== undefined ? this : globalObject;
  388. if (!exports.is(esValue)) {
  389. throw new globalObject.TypeError(
  390. "'get align' called on an object that is not a valid instance of HTMLObjectElement."
  391. );
  392. }
  393. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  394. try {
  395. const value = esValue[implSymbol]._reflectGetTheContentAttribute("align");
  396. return value === null ? "" : value;
  397. } finally {
  398. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  399. }
  400. }
  401. set align(V) {
  402. const esValue = this !== null && this !== undefined ? this : globalObject;
  403. if (!exports.is(esValue)) {
  404. throw new globalObject.TypeError(
  405. "'set align' called on an object that is not a valid instance of HTMLObjectElement."
  406. );
  407. }
  408. V = conversions["DOMString"](V, {
  409. context: "Failed to set the 'align' property on 'HTMLObjectElement': The provided value",
  410. globals: globalObject
  411. });
  412. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  413. try {
  414. esValue[implSymbol]._reflectSetTheContentAttribute("align", V);
  415. } finally {
  416. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  417. }
  418. }
  419. get archive() {
  420. const esValue = this !== null && this !== undefined ? this : globalObject;
  421. if (!exports.is(esValue)) {
  422. throw new globalObject.TypeError(
  423. "'get archive' called on an object that is not a valid instance of HTMLObjectElement."
  424. );
  425. }
  426. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  427. try {
  428. const value = esValue[implSymbol]._reflectGetTheContentAttribute("archive");
  429. return value === null ? "" : value;
  430. } finally {
  431. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  432. }
  433. }
  434. set archive(V) {
  435. const esValue = this !== null && this !== undefined ? this : globalObject;
  436. if (!exports.is(esValue)) {
  437. throw new globalObject.TypeError(
  438. "'set archive' called on an object that is not a valid instance of HTMLObjectElement."
  439. );
  440. }
  441. V = conversions["DOMString"](V, {
  442. context: "Failed to set the 'archive' property on 'HTMLObjectElement': The provided value",
  443. globals: globalObject
  444. });
  445. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  446. try {
  447. esValue[implSymbol]._reflectSetTheContentAttribute("archive", V);
  448. } finally {
  449. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  450. }
  451. }
  452. get code() {
  453. const esValue = this !== null && this !== undefined ? this : globalObject;
  454. if (!exports.is(esValue)) {
  455. throw new globalObject.TypeError(
  456. "'get code' called on an object that is not a valid instance of HTMLObjectElement."
  457. );
  458. }
  459. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  460. try {
  461. const value = esValue[implSymbol]._reflectGetTheContentAttribute("code");
  462. return value === null ? "" : value;
  463. } finally {
  464. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  465. }
  466. }
  467. set code(V) {
  468. const esValue = this !== null && this !== undefined ? this : globalObject;
  469. if (!exports.is(esValue)) {
  470. throw new globalObject.TypeError(
  471. "'set code' called on an object that is not a valid instance of HTMLObjectElement."
  472. );
  473. }
  474. V = conversions["DOMString"](V, {
  475. context: "Failed to set the 'code' property on 'HTMLObjectElement': The provided value",
  476. globals: globalObject
  477. });
  478. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  479. try {
  480. esValue[implSymbol]._reflectSetTheContentAttribute("code", V);
  481. } finally {
  482. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  483. }
  484. }
  485. get declare() {
  486. const esValue = this !== null && this !== undefined ? this : globalObject;
  487. if (!exports.is(esValue)) {
  488. throw new globalObject.TypeError(
  489. "'get declare' called on an object that is not a valid instance of HTMLObjectElement."
  490. );
  491. }
  492. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  493. try {
  494. return esValue[implSymbol]._reflectGetTheContentAttribute("declare") !== null;
  495. } finally {
  496. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  497. }
  498. }
  499. set declare(V) {
  500. const esValue = this !== null && this !== undefined ? this : globalObject;
  501. if (!exports.is(esValue)) {
  502. throw new globalObject.TypeError(
  503. "'set declare' called on an object that is not a valid instance of HTMLObjectElement."
  504. );
  505. }
  506. V = conversions["boolean"](V, {
  507. context: "Failed to set the 'declare' property on 'HTMLObjectElement': The provided value",
  508. globals: globalObject
  509. });
  510. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  511. try {
  512. if (V) {
  513. esValue[implSymbol]._reflectSetTheContentAttribute("declare", "");
  514. } else {
  515. esValue[implSymbol]._reflectDeleteTheContentAttribute("declare");
  516. }
  517. } finally {
  518. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  519. }
  520. }
  521. get hspace() {
  522. const esValue = this !== null && this !== undefined ? this : globalObject;
  523. if (!exports.is(esValue)) {
  524. throw new globalObject.TypeError(
  525. "'get hspace' called on an object that is not a valid instance of HTMLObjectElement."
  526. );
  527. }
  528. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  529. try {
  530. let value = esValue[implSymbol]._reflectGetTheContentAttribute("hspace");
  531. if (value !== null) {
  532. value = parseNonNegativeInteger_jsdom_living_helpers_strings(value);
  533. if (value !== null && value >= 0 && value <= 2147483647) {
  534. return value;
  535. }
  536. }
  537. return 0;
  538. } finally {
  539. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  540. }
  541. }
  542. set hspace(V) {
  543. const esValue = this !== null && this !== undefined ? this : globalObject;
  544. if (!exports.is(esValue)) {
  545. throw new globalObject.TypeError(
  546. "'set hspace' called on an object that is not a valid instance of HTMLObjectElement."
  547. );
  548. }
  549. V = conversions["unsigned long"](V, {
  550. context: "Failed to set the 'hspace' property on 'HTMLObjectElement': The provided value",
  551. globals: globalObject
  552. });
  553. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  554. try {
  555. const newValue = V <= 2147483647 && V >= 0 ? V : 0;
  556. esValue[implSymbol]._reflectSetTheContentAttribute("hspace", String(newValue));
  557. } finally {
  558. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  559. }
  560. }
  561. get standby() {
  562. const esValue = this !== null && this !== undefined ? this : globalObject;
  563. if (!exports.is(esValue)) {
  564. throw new globalObject.TypeError(
  565. "'get standby' called on an object that is not a valid instance of HTMLObjectElement."
  566. );
  567. }
  568. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  569. try {
  570. const value = esValue[implSymbol]._reflectGetTheContentAttribute("standby");
  571. return value === null ? "" : value;
  572. } finally {
  573. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  574. }
  575. }
  576. set standby(V) {
  577. const esValue = this !== null && this !== undefined ? this : globalObject;
  578. if (!exports.is(esValue)) {
  579. throw new globalObject.TypeError(
  580. "'set standby' called on an object that is not a valid instance of HTMLObjectElement."
  581. );
  582. }
  583. V = conversions["DOMString"](V, {
  584. context: "Failed to set the 'standby' property on 'HTMLObjectElement': The provided value",
  585. globals: globalObject
  586. });
  587. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  588. try {
  589. esValue[implSymbol]._reflectSetTheContentAttribute("standby", V);
  590. } finally {
  591. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  592. }
  593. }
  594. get vspace() {
  595. const esValue = this !== null && this !== undefined ? this : globalObject;
  596. if (!exports.is(esValue)) {
  597. throw new globalObject.TypeError(
  598. "'get vspace' called on an object that is not a valid instance of HTMLObjectElement."
  599. );
  600. }
  601. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  602. try {
  603. let value = esValue[implSymbol]._reflectGetTheContentAttribute("vspace");
  604. if (value !== null) {
  605. value = parseNonNegativeInteger_jsdom_living_helpers_strings(value);
  606. if (value !== null && value >= 0 && value <= 2147483647) {
  607. return value;
  608. }
  609. }
  610. return 0;
  611. } finally {
  612. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  613. }
  614. }
  615. set vspace(V) {
  616. const esValue = this !== null && this !== undefined ? this : globalObject;
  617. if (!exports.is(esValue)) {
  618. throw new globalObject.TypeError(
  619. "'set vspace' called on an object that is not a valid instance of HTMLObjectElement."
  620. );
  621. }
  622. V = conversions["unsigned long"](V, {
  623. context: "Failed to set the 'vspace' property on 'HTMLObjectElement': The provided value",
  624. globals: globalObject
  625. });
  626. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  627. try {
  628. const newValue = V <= 2147483647 && V >= 0 ? V : 0;
  629. esValue[implSymbol]._reflectSetTheContentAttribute("vspace", String(newValue));
  630. } finally {
  631. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  632. }
  633. }
  634. get codeBase() {
  635. const esValue = this !== null && this !== undefined ? this : globalObject;
  636. if (!exports.is(esValue)) {
  637. throw new globalObject.TypeError(
  638. "'get codeBase' called on an object that is not a valid instance of HTMLObjectElement."
  639. );
  640. }
  641. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  642. try {
  643. const impl = esValue[implSymbol];
  644. const value = impl._reflectGetTheContentAttribute("codebase");
  645. if (value === null) {
  646. return "";
  647. }
  648. const document = impl._ownerDocument;
  649. if (this._codebaseURLCacheKey === value && this._baseURLCache === document._baseURLCache) {
  650. return this._codebaseURLCache;
  651. }
  652. this._codebaseURLCacheKey = value;
  653. this._baseURLCache = document._baseURLCache;
  654. const urlRecord = document.encodingParseAURL(value);
  655. if (urlRecord !== null) {
  656. this._codebaseURLCache = serializeURLwhatwg_url(urlRecord);
  657. return this._codebaseURLCache;
  658. }
  659. this._codebaseURLCache = conversions.USVString(value);
  660. return this._codebaseURLCache;
  661. } finally {
  662. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  663. }
  664. }
  665. set codeBase(V) {
  666. const esValue = this !== null && this !== undefined ? this : globalObject;
  667. if (!exports.is(esValue)) {
  668. throw new globalObject.TypeError(
  669. "'set codeBase' called on an object that is not a valid instance of HTMLObjectElement."
  670. );
  671. }
  672. V = conversions["DOMString"](V, {
  673. context: "Failed to set the 'codeBase' property on 'HTMLObjectElement': The provided value",
  674. globals: globalObject
  675. });
  676. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  677. try {
  678. esValue[implSymbol]._reflectSetTheContentAttribute("codebase", V);
  679. } finally {
  680. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  681. }
  682. }
  683. get codeType() {
  684. const esValue = this !== null && this !== undefined ? this : globalObject;
  685. if (!exports.is(esValue)) {
  686. throw new globalObject.TypeError(
  687. "'get codeType' called on an object that is not a valid instance of HTMLObjectElement."
  688. );
  689. }
  690. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  691. try {
  692. const value = esValue[implSymbol]._reflectGetTheContentAttribute("codetype");
  693. return value === null ? "" : value;
  694. } finally {
  695. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  696. }
  697. }
  698. set codeType(V) {
  699. const esValue = this !== null && this !== undefined ? this : globalObject;
  700. if (!exports.is(esValue)) {
  701. throw new globalObject.TypeError(
  702. "'set codeType' called on an object that is not a valid instance of HTMLObjectElement."
  703. );
  704. }
  705. V = conversions["DOMString"](V, {
  706. context: "Failed to set the 'codeType' property on 'HTMLObjectElement': The provided value",
  707. globals: globalObject
  708. });
  709. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  710. try {
  711. esValue[implSymbol]._reflectSetTheContentAttribute("codetype", V);
  712. } finally {
  713. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  714. }
  715. }
  716. get border() {
  717. const esValue = this !== null && this !== undefined ? this : globalObject;
  718. if (!exports.is(esValue)) {
  719. throw new globalObject.TypeError(
  720. "'get border' called on an object that is not a valid instance of HTMLObjectElement."
  721. );
  722. }
  723. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  724. try {
  725. const value = esValue[implSymbol]._reflectGetTheContentAttribute("border");
  726. return value === null ? "" : value;
  727. } finally {
  728. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  729. }
  730. }
  731. set border(V) {
  732. const esValue = this !== null && this !== undefined ? this : globalObject;
  733. if (!exports.is(esValue)) {
  734. throw new globalObject.TypeError(
  735. "'set border' called on an object that is not a valid instance of HTMLObjectElement."
  736. );
  737. }
  738. V = conversions["DOMString"](V, {
  739. context: "Failed to set the 'border' property on 'HTMLObjectElement': The provided value",
  740. globals: globalObject,
  741. treatNullAsEmptyString: true
  742. });
  743. ceReactionsPreSteps_jsdom_living_helpers_custom_elements(globalObject);
  744. try {
  745. esValue[implSymbol]._reflectSetTheContentAttribute("border", V);
  746. } finally {
  747. ceReactionsPostSteps_jsdom_living_helpers_custom_elements(globalObject);
  748. }
  749. }
  750. }
  751. Object.defineProperties(HTMLObjectElement.prototype, {
  752. checkValidity: { enumerable: true },
  753. reportValidity: { enumerable: true },
  754. setCustomValidity: { enumerable: true },
  755. data: { enumerable: true },
  756. type: { enumerable: true },
  757. name: { enumerable: true },
  758. useMap: { enumerable: true },
  759. form: { enumerable: true },
  760. width: { enumerable: true },
  761. height: { enumerable: true },
  762. contentDocument: { enumerable: true },
  763. willValidate: { enumerable: true },
  764. validity: { enumerable: true },
  765. validationMessage: { enumerable: true },
  766. align: { enumerable: true },
  767. archive: { enumerable: true },
  768. code: { enumerable: true },
  769. declare: { enumerable: true },
  770. hspace: { enumerable: true },
  771. standby: { enumerable: true },
  772. vspace: { enumerable: true },
  773. codeBase: { enumerable: true },
  774. codeType: { enumerable: true },
  775. border: { enumerable: true },
  776. [Symbol.toStringTag]: { value: "HTMLObjectElement", configurable: true }
  777. });
  778. ctorRegistry[interfaceName] = HTMLObjectElement;
  779. Object.defineProperty(globalObject, interfaceName, {
  780. configurable: true,
  781. writable: true,
  782. value: HTMLObjectElement
  783. });
  784. };
  785. const Impl = require("../../jsdom/living/nodes/HTMLObjectElement-impl.js");