SVGSVGElement.js 25 KB

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