Range.js 22 KB

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