HTMLBodyElement.js 28 KB

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