buninu-browser 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +13 -0
- package/Architecture.md +601 -0
- package/LICENSE +21 -0
- package/LICENSES/Apache-2.0.txt +202 -0
- package/LICENSES/BSD-3-Clause-Skia.txt +29 -0
- package/LICENSES/Bitstream-Vera.txt +44 -0
- package/LICENSES/CC-BY-4.0.txt +396 -0
- package/LICENSES/OFL-1.1.txt +91 -0
- package/LICENSES/README.md +9 -0
- package/LICENSES/acorn.txt +21 -0
- package/LICENSES/chromium.txt +27 -0
- package/LICENSES/dropflow.txt +19 -0
- package/LICENSES/emscripten.txt +102 -0
- package/LICENSES/freetype.txt +169 -0
- package/LICENSES/happy-dom.txt +22 -0
- package/LICENSES/harfbuzz.txt +42 -0
- package/LICENSES/icu.txt +512 -0
- package/LICENSES/libjpeg-ijg.txt +260 -0
- package/LICENSES/libjpeg-turbo.txt +147 -0
- package/LICENSES/libpng.txt +134 -0
- package/LICENSES/libwebp.txt +30 -0
- package/LICENSES/ses-aura.txt +16 -0
- package/LICENSES/ses-caja.txt +13 -0
- package/LICENSES/ses-corejs.txt +19 -0
- package/LICENSES/ses-v8.txt +9 -0
- package/LICENSES/ses.txt +201 -0
- package/LICENSES/termdom.txt +21 -0
- package/LICENSES/wasmpeg.txt +501 -0
- package/LICENSES/woff2.txt +19 -0
- package/LICENSES/wuffs.txt +211 -0
- package/LICENSES/zlib.txt +22 -0
- package/Linux +0 -0
- package/PORTING.md +825 -0
- package/README.md +283 -0
- package/THIRD_PARTY_NOTICES.md +224 -0
- package/bunfig.toml +2 -0
- package/buninu-browser.js +65 -0
- package/index.js +149 -0
- package/lib/cdp-server.js +1424 -0
- package/lib/cdp.js +203 -0
- package/lib/happy-dom/entities-adapter.js +51 -0
- package/lib/happy-dom/image-size-adapter.js +8 -0
- package/lib/happy-dom/mime-type-adapter.js +27 -0
- package/lib/happy-dom/parser.js +53 -0
- package/lib/happy-dom/websocket-adapter.js +62 -0
- package/lib/headless-shell.js +362 -0
- package/lib/input/hit-test.js +78 -0
- package/lib/layout/scroll-viewport.js +53 -0
- package/lib/layout/text-layout.js +2236 -0
- package/lib/log.js +85 -0
- package/lib/network/cookie-jar.js +178 -0
- package/lib/network/network-service.js +268 -0
- package/lib/network/resolver.js +97 -0
- package/lib/paint/display-list.js +359 -0
- package/lib/paint/frame.js +88 -0
- package/lib/paint/gradient.js +207 -0
- package/lib/render-tree/index.js +263 -0
- package/lib/render-tree/svg.js +210 -0
- package/lib/renderer/bindings.js +1291 -0
- package/lib/renderer/compositor.js +123 -0
- package/lib/renderer/flags.js +20 -0
- package/lib/renderer/host.js +503 -0
- package/lib/renderer/main.js +234 -0
- package/lib/renderer/module-transform.js +399 -0
- package/lib/renderer/page-realm.js +1471 -0
- package/lib/renderer/page-renderer.js +1691 -0
- package/lib/renderer/script-rewrite.js +232 -0
- package/lib/renderer/seccomp.js +215 -0
- package/lib/renderer/syscall-numbers.js +139 -0
- package/lib/style/computed-style.js +2053 -0
- package/package.json +39 -0
- package/patches/happy-dom/0001-use-bun-entity-adapter.patch +15 -0
- package/patches/happy-dom/0002-use-bun-platform-adapters.patch +69 -0
- package/patches/happy-dom/README.md +38 -0
- package/test/chromium-headless-shell +5 -0
- package/test/compositor.test.js +154 -0
- package/test/computed-style.test.js +434 -0
- package/test/display-list.test.js +128 -0
- package/test/entities-adapter.test.js +43 -0
- package/test/fixtures/fake-renderer.js +26 -0
- package/test/fixtures/seccomp-child.js +32 -0
- package/test/fixtures/video.mp4 +0 -0
- package/test/flex.test.js +150 -0
- package/test/gradient.test.js +56 -0
- package/test/grid.test.js +253 -0
- package/test/happy-dom-platform-adapters.test.js +18 -0
- package/test/headless-shell.test.js +318 -0
- package/test/hit-test.test.js +49 -0
- package/test/html-parser.test.js +40 -0
- package/test/index.test.js +29 -0
- package/test/log.test.js +40 -0
- package/test/mobile.test.js +85 -0
- package/test/network-service.test.js +214 -0
- package/test/page-scripts.test.js +552 -0
- package/test/poc-backend.js +189 -0
- package/test/poc-backend.test.js +154 -0
- package/test/positioning.test.js +112 -0
- package/test/render-tree.test.js +103 -0
- package/test/renderer-host.test.js +69 -0
- package/test/resolver.test.js +51 -0
- package/test/script-rewrite.test.js +31 -0
- package/test/scroll-viewport.test.js +25 -0
- package/test/seccomp.test.js +71 -0
- package/test/site-isolation.test.js +74 -0
- package/test/svg.test.js +61 -0
- package/test/text-layout.test.js +419 -0
- package/usr/README.md +20 -0
- package/usr/lib/canvaskit/LICENSE +29 -0
- package/usr/lib/canvaskit/canvaskit.js +264 -0
- package/usr/lib/canvaskit/canvaskit.wasm +0 -0
- package/usr/share/fonts/DejaVuSansMono-Bold.ttf +0 -0
- package/usr/share/fonts/DejaVuSansMono.ttf +0 -0
- package/usr/share/fonts/LICENSE-Apache-2.0.txt +202 -0
- package/usr/share/fonts/LICENSE-DejaVu.txt +44 -0
- package/usr/share/fonts/LICENSE-OFL-1.1.txt +91 -0
- package/usr/share/fonts/NotoColorEmoji.ttf +0 -0
- package/usr/share/fonts/NotoColorEmojiFlags.ttf +0 -0
- package/usr/share/fonts/NotoSansCJK-Regular.ttc +0 -0
- package/usr/share/fonts/NotoSansSymbols-Regular-Subsetted.ttf +0 -0
- package/usr/share/fonts/NotoSansSymbols-Regular-Subsetted2.ttf +0 -0
- package/usr/share/fonts/Roboto-Regular.ttf +0 -0
- package/usr/share/fonts/fonts.json +28 -0
- package/vendor/acorn/LICENSE +21 -0
- package/vendor/acorn/README.md +309 -0
- package/vendor/acorn/dist/acorn.mjs +6313 -0
- package/vendor/acorn/package.json +50 -0
- package/vendor/happy-dom/.editorconfig +8 -0
- package/vendor/happy-dom/.eslintignore +6 -0
- package/vendor/happy-dom/.eslintrc.cjs +188 -0
- package/vendor/happy-dom/.github/CODEOWNERS +2 -0
- package/vendor/happy-dom/.github/FUNDING.yml +1 -0
- package/vendor/happy-dom/.github/ISSUE_TEMPLATE/bug_report.md +32 -0
- package/vendor/happy-dom/.github/ISSUE_TEMPLATE/custom.md +10 -0
- package/vendor/happy-dom/.github/ISSUE_TEMPLATE/feature_request.md +19 -0
- package/vendor/happy-dom/.github/PULL_REQUEST_TEMPLATE.md +27 -0
- package/vendor/happy-dom/.github/workflows/auto-assign.yml +23 -0
- package/vendor/happy-dom/.github/workflows/pull_request.yml +53 -0
- package/vendor/happy-dom/.github/workflows/release.yml +143 -0
- package/vendor/happy-dom/.husky/pre-commit +1 -0
- package/vendor/happy-dom/.prettierignore +1 -0
- package/vendor/happy-dom/.prettierrc.cjs +6 -0
- package/vendor/happy-dom/.vscode/extensions.json +3 -0
- package/vendor/happy-dom/CODE_OF_CONDUCT.md +128 -0
- package/vendor/happy-dom/CONTRIBUTING.md +147 -0
- package/vendor/happy-dom/LICENSE +21 -0
- package/vendor/happy-dom/README.md +62 -0
- package/vendor/happy-dom/SECURITY.md +12 -0
- package/vendor/happy-dom/cspell.json +34 -0
- package/vendor/happy-dom/docs/happy-dom-logo.jpg +0 -0
- package/vendor/happy-dom/integration-test/.editorconfig +8 -0
- package/vendor/happy-dom/integration-test/LICENSE +21 -0
- package/vendor/happy-dom/integration-test/README.md +1 -0
- package/vendor/happy-dom/integration-test/package.json +24 -0
- package/vendor/happy-dom/package-lock.json +15520 -0
- package/vendor/happy-dom/package.json +55 -0
- package/vendor/happy-dom/packages/@happy-dom/global-registrator/LICENSE +21 -0
- package/vendor/happy-dom/packages/@happy-dom/global-registrator/README.md +60 -0
- package/vendor/happy-dom/packages/@happy-dom/global-registrator/package.json +52 -0
- package/vendor/happy-dom/packages/@happy-dom/global-registrator/register.js +2 -0
- package/vendor/happy-dom/packages/@happy-dom/global-registrator/src/GlobalRegistrator.ts +121 -0
- package/vendor/happy-dom/packages/@happy-dom/global-registrator/src/index.ts +3 -0
- package/vendor/happy-dom/packages/@happy-dom/global-registrator/tsconfig.json +30 -0
- package/vendor/happy-dom/packages/@happy-dom/jest-environment/LICENSE +21 -0
- package/vendor/happy-dom/packages/@happy-dom/jest-environment/README.md +71 -0
- package/vendor/happy-dom/packages/@happy-dom/jest-environment/package.json +93 -0
- package/vendor/happy-dom/packages/@happy-dom/jest-environment/src/index.ts +192 -0
- package/vendor/happy-dom/packages/@happy-dom/jest-environment/tsconfig.json +30 -0
- package/vendor/happy-dom/packages/@happy-dom/node-canvas-adapter/README.md +48 -0
- package/vendor/happy-dom/packages/@happy-dom/node-canvas-adapter/package.json +41 -0
- package/vendor/happy-dom/packages/@happy-dom/node-canvas-adapter/src/CanvasAdapter.ts +275 -0
- package/vendor/happy-dom/packages/@happy-dom/node-canvas-adapter/src/index.ts +1 -0
- package/vendor/happy-dom/packages/@happy-dom/server-renderer/LICENSE +21 -0
- package/vendor/happy-dom/packages/@happy-dom/server-renderer/README.md +100 -0
- package/vendor/happy-dom/packages/@happy-dom/server-renderer/bin/src/happy-dom-sr.ts +30 -0
- package/vendor/happy-dom/packages/@happy-dom/server-renderer/package.json +62 -0
- package/vendor/happy-dom/packages/@happy-dom/server-renderer/src/ServerRenderer.ts +368 -0
- package/vendor/happy-dom/packages/@happy-dom/server-renderer/src/ServerRendererBrowser.ts +142 -0
- package/vendor/happy-dom/packages/@happy-dom/server-renderer/src/ServerRendererBrowserWorker.ts +29 -0
- package/vendor/happy-dom/packages/@happy-dom/server-renderer/src/ServerRendererPage.ts +305 -0
- package/vendor/happy-dom/packages/@happy-dom/server-renderer/src/ServerRendererPageWorker.ts +55 -0
- package/vendor/happy-dom/packages/@happy-dom/server-renderer/src/ServerRendererServer.ts +332 -0
- package/vendor/happy-dom/packages/@happy-dom/server-renderer/src/config/DefaultServerRendererConfiguration.ts +47 -0
- package/vendor/happy-dom/packages/@happy-dom/server-renderer/src/enums/ServerRendererLogLevelEnum.ts +9 -0
- package/vendor/happy-dom/packages/@happy-dom/server-renderer/src/enums/ServerRendererModeEnum.ts +8 -0
- package/vendor/happy-dom/packages/@happy-dom/server-renderer/src/index.ts +19 -0
- package/vendor/happy-dom/packages/@happy-dom/server-renderer/src/types/IOptionalServerRendererConfiguration.ts +127 -0
- package/vendor/happy-dom/packages/@happy-dom/server-renderer/src/types/IServerRendererConfiguration.ts +126 -0
- package/vendor/happy-dom/packages/@happy-dom/server-renderer/src/types/IServerRendererItem.ts +6 -0
- package/vendor/happy-dom/packages/@happy-dom/server-renderer/src/types/IServerRendererResult.ts +11 -0
- package/vendor/happy-dom/packages/@happy-dom/server-renderer/src/utilities/BrowserWindowPolyfill.ts +138 -0
- package/vendor/happy-dom/packages/@happy-dom/server-renderer/src/utilities/HelpPrinter.ts +36 -0
- package/vendor/happy-dom/packages/@happy-dom/server-renderer/src/utilities/HelpPrinterRows.ts +288 -0
- package/vendor/happy-dom/packages/@happy-dom/server-renderer/src/utilities/PackageVersion.ts +12 -0
- package/vendor/happy-dom/packages/@happy-dom/server-renderer/src/utilities/ProcessArgumentsParser.ts +387 -0
- package/vendor/happy-dom/packages/@happy-dom/server-renderer/src/utilities/ServerRendererConfigurationFactory.ts +91 -0
- package/vendor/happy-dom/packages/happy-dom/LICENSE +21 -0
- package/vendor/happy-dom/packages/happy-dom/README.md +42 -0
- package/vendor/happy-dom/packages/happy-dom/package.json +58 -0
- package/vendor/happy-dom/packages/happy-dom/src/PropertySymbol.ts +431 -0
- package/vendor/happy-dom/packages/happy-dom/src/animation/Animation.ts +273 -0
- package/vendor/happy-dom/packages/happy-dom/src/animation/AnimationTimeline.ts +15 -0
- package/vendor/happy-dom/packages/happy-dom/src/animation/DocumentTimeline.ts +33 -0
- package/vendor/happy-dom/packages/happy-dom/src/animation/KeyframeEffect.ts +295 -0
- package/vendor/happy-dom/packages/happy-dom/src/async-task-manager/AsyncTaskManager.ts +340 -0
- package/vendor/happy-dom/packages/happy-dom/src/async-task-manager/AsyncTaskManagerDebugError.ts +14 -0
- package/vendor/happy-dom/packages/happy-dom/src/base64/Base64.ts +97 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/Browser.ts +123 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/BrowserContext.ts +100 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/BrowserFrame.ts +232 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/BrowserPage.ts +205 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/BrowserSettingsFactory.ts +96 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/DefaultBrowserSettings.ts +67 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/detached-browser/DetachedBrowser.ts +129 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/detached-browser/DetachedBrowserContext.ts +103 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/detached-browser/DetachedBrowserFrame.ts +250 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/detached-browser/DetachedBrowserPage.ts +218 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/enums/BrowserErrorCaptureEnum.ts +10 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/enums/BrowserNavigationCrossOriginPolicyEnum.ts +10 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/types/IBrowser.ts +51 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/types/IBrowserContext.ts +44 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/types/IBrowserFrame.ts +112 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/types/IBrowserPage.ts +110 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/types/IBrowserPageViewport.ts +5 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/types/IBrowserSettings.ts +194 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/types/IGoToOptions.ts +17 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/types/IOptionalBrowserPageViewport.ts +5 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/types/IOptionalBrowserSettings.ts +190 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/types/IReloadOptions.ts +27 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/utilities/BrowserExceptionObserver.ts +123 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/utilities/BrowserFrameFactory.ts +106 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/utilities/BrowserFrameNavigator.ts +574 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/utilities/BrowserFrameScriptEvaluator.ts +71 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/utilities/BrowserFrameURL.ts +30 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/utilities/BrowserFrameValidator.ts +84 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/utilities/BrowserPageUtility.ts +56 -0
- package/vendor/happy-dom/packages/happy-dom/src/canvas/ICanvasAdapter.ts +63 -0
- package/vendor/happy-dom/packages/happy-dom/src/canvas/ICanvasAdapterCaller.ts +9 -0
- package/vendor/happy-dom/packages/happy-dom/src/canvas/ICanvasGradient.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/canvas/ICanvasPattern.ts +10 -0
- package/vendor/happy-dom/packages/happy-dom/src/canvas/ICanvasRenderingContext2D.ts +162 -0
- package/vendor/happy-dom/packages/happy-dom/src/canvas/ICanvasShape.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/canvas/IImageBitmapOptions.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/canvas/ITextMetrics.ts +12 -0
- package/vendor/happy-dom/packages/happy-dom/src/canvas/ImageBitmap.ts +162 -0
- package/vendor/happy-dom/packages/happy-dom/src/canvas/ImageData.ts +83 -0
- package/vendor/happy-dom/packages/happy-dom/src/canvas/OffscreenCanvas.ts +162 -0
- package/vendor/happy-dom/packages/happy-dom/src/canvas/TCanvasImage.ts +14 -0
- package/vendor/happy-dom/packages/happy-dom/src/canvas/TImageBitmapSource.ts +12 -0
- package/vendor/happy-dom/packages/happy-dom/src/clipboard/Clipboard.ts +108 -0
- package/vendor/happy-dom/packages/happy-dom/src/clipboard/ClipboardItem.ts +57 -0
- package/vendor/happy-dom/packages/happy-dom/src/config/HTMLElementConfig.ts +536 -0
- package/vendor/happy-dom/packages/happy-dom/src/config/HTMLElementConfigContentModelEnum.ts +12 -0
- package/vendor/happy-dom/packages/happy-dom/src/config/IHTMLElementTagNameMap.ts +181 -0
- package/vendor/happy-dom/packages/happy-dom/src/config/ISVGElementTagNameMap.ts +127 -0
- package/vendor/happy-dom/packages/happy-dom/src/config/NamespaceURI.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/config/SVGElementConfig.ts +70 -0
- package/vendor/happy-dom/packages/happy-dom/src/console/IConsole.ts +161 -0
- package/vendor/happy-dom/packages/happy-dom/src/console/IVirtualConsoleLogEntry.ts +10 -0
- package/vendor/happy-dom/packages/happy-dom/src/console/IVirtualConsoleLogGroup.ts +6 -0
- package/vendor/happy-dom/packages/happy-dom/src/console/IVirtualConsolePrinter.ts +58 -0
- package/vendor/happy-dom/packages/happy-dom/src/console/VirtualConsole.ts +363 -0
- package/vendor/happy-dom/packages/happy-dom/src/console/VirtualConsolePrinter.ts +148 -0
- package/vendor/happy-dom/packages/happy-dom/src/console/enums/VirtualConsoleLogLevelEnum.ts +12 -0
- package/vendor/happy-dom/packages/happy-dom/src/console/enums/VirtualConsoleLogTypeEnum.ts +29 -0
- package/vendor/happy-dom/packages/happy-dom/src/console/utilities/VirtualConsoleLogEntryStringifier.ts +100 -0
- package/vendor/happy-dom/packages/happy-dom/src/cookie/CookieContainer.ts +91 -0
- package/vendor/happy-dom/packages/happy-dom/src/cookie/DefaultCookie.ts +17 -0
- package/vendor/happy-dom/packages/happy-dom/src/cookie/ICookie.ts +14 -0
- package/vendor/happy-dom/packages/happy-dom/src/cookie/ICookieContainer.ts +33 -0
- package/vendor/happy-dom/packages/happy-dom/src/cookie/IOptionalCookie.ts +16 -0
- package/vendor/happy-dom/packages/happy-dom/src/cookie/enums/CookieSameSiteEnum.ts +6 -0
- package/vendor/happy-dom/packages/happy-dom/src/cookie/urilities/CookieExpireUtility.ts +16 -0
- package/vendor/happy-dom/packages/happy-dom/src/cookie/urilities/CookieStringUtility.ts +119 -0
- package/vendor/happy-dom/packages/happy-dom/src/cookie/urilities/CookieURLUtility.ts +27 -0
- package/vendor/happy-dom/packages/happy-dom/src/cookie-store/CookieStore.ts +226 -0
- package/vendor/happy-dom/packages/happy-dom/src/cookie-store/ICookieStoreDeleteOptions.ts +9 -0
- package/vendor/happy-dom/packages/happy-dom/src/cookie-store/ICookieStoreGetOptions.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/cookie-store/ICookieStoreItem.ts +13 -0
- package/vendor/happy-dom/packages/happy-dom/src/cookie-store/ICookieStoreSetOptions.ts +12 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/CSS.ts +63 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/CSSRule.ts +84 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/CSSRuleTypeEnum.ts +18 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/CSSStyleSheet.ts +141 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/CSSUnitValue.ts +26 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/CSSUnits.ts +31 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/MediaList.ts +177 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/declaration/CSSPropertyList.ts +1273 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/declaration/CSSStyleDeclaration.ts +355 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/declaration/ICSSStyleDeclaration.ts +1178 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/declaration/computed-style/CSSComputedStyle.ts +502 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/declaration/computed-style/config/CSSComputedStyleElementDefault.ts +133 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/declaration/computed-style/config/CSSComputedStyleInheritedProperties.ts +39 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/declaration/computed-style/config/CSSComputedStyleMeasurementProperties.ts +41 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/declaration/property-manager/CSSPropertyManager.ts +641 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/declaration/property-manager/parsers/CSSPropertyGetParser.ts +741 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/declaration/property-manager/parsers/CSSPropertySetParser.ts +2955 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/declaration/property-manager/types/ICSSPropertyMap.ts +5 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/declaration/property-manager/types/ICSSPropertyValue.ts +4 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/declaration/property-manager/utilities/CSSStringUtility.ts +90 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/declaration/property-manager/utilities/CSSValueFormatter.ts +447 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/declaration/property-manager/utilities/CSSVariableFormatter.ts +76 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/declaration/utilities/CSSMeasurementConverter.ts +79 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/declaration/utilities/CSSTextParser.ts +44 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/rules/CSSConditionRule.ts +20 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/rules/CSSContainerRule.ts +34 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/rules/CSSFontFaceRule.ts +45 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/rules/CSSGroupingRule.ts +84 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/rules/CSSKeyframeRule.ts +53 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/rules/CSSKeyframesRule.ts +147 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/rules/CSSMediaRule.ts +50 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/rules/CSSScopeRule.ts +53 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/rules/CSSStyleRule.ts +73 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/rules/CSSSupportsRule.ts +30 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/style-property-map/CSSKeywordValue.ts +35 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/style-property-map/CSSStyleValue.ts +37 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/style-property-map/StylePropertyMap.ts +45 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/style-property-map/StylePropertyMapReadOnly.ts +128 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/utilities/CSSEscaper.ts +87 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/utilities/CSSRuleParser.ts +315 -0
- package/vendor/happy-dom/packages/happy-dom/src/custom-element/CustomElementReactionStack.ts +91 -0
- package/vendor/happy-dom/packages/happy-dom/src/custom-element/CustomElementRegistry.ts +186 -0
- package/vendor/happy-dom/packages/happy-dom/src/custom-element/CustomElementUtility.ts +34 -0
- package/vendor/happy-dom/packages/happy-dom/src/custom-element/ICustomElementDefinition.ts +16 -0
- package/vendor/happy-dom/packages/happy-dom/src/dom/DOMPoint.ts +84 -0
- package/vendor/happy-dom/packages/happy-dom/src/dom/DOMPointReadOnly.ts +117 -0
- package/vendor/happy-dom/packages/happy-dom/src/dom/DOMRect.ts +92 -0
- package/vendor/happy-dom/packages/happy-dom/src/dom/DOMRectList.ts +34 -0
- package/vendor/happy-dom/packages/happy-dom/src/dom/DOMRectReadOnly.ts +129 -0
- package/vendor/happy-dom/packages/happy-dom/src/dom/DOMStringMap.ts +93 -0
- package/vendor/happy-dom/packages/happy-dom/src/dom/DOMStringMapUtility.ts +33 -0
- package/vendor/happy-dom/packages/happy-dom/src/dom/DOMTokenList.ts +363 -0
- package/vendor/happy-dom/packages/happy-dom/src/dom/IDOMPointInit.ts +6 -0
- package/vendor/happy-dom/packages/happy-dom/src/dom/IDOMRectInit.ts +6 -0
- package/vendor/happy-dom/packages/happy-dom/src/dom/dom-matrix/DOMMatrix.ts +526 -0
- package/vendor/happy-dom/packages/happy-dom/src/dom/dom-matrix/DOMMatrixReadOnly.ts +1608 -0
- package/vendor/happy-dom/packages/happy-dom/src/dom/dom-matrix/IDOMMatrixCompatibleObject.ts +24 -0
- package/vendor/happy-dom/packages/happy-dom/src/dom/dom-matrix/IDOMMatrixJSON.ts +26 -0
- package/vendor/happy-dom/packages/happy-dom/src/dom/dom-matrix/TDOMMatrix2DArray.ts +3 -0
- package/vendor/happy-dom/packages/happy-dom/src/dom/dom-matrix/TDOMMatrix3DArray.ts +20 -0
- package/vendor/happy-dom/packages/happy-dom/src/dom/dom-matrix/TDOMMatrixInit.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/dom-implementation/DOMImplementation.ts +81 -0
- package/vendor/happy-dom/packages/happy-dom/src/dom-parser/DOMParser.ts +47 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/DataTransfer.ts +128 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/DataTransferItem.ts +47 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/DataTransferItemList.ts +44 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/Event.ts +222 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/EventPhaseEnum.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/EventTarget.ts +396 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/IEventInit.ts +5 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/IEventListenerOptions.ts +10 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/ITouchInit.ts +16 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/IUIEventInit.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/MessagePort.ts +32 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/TEventListener.ts +4 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/TEventListenerFunction.ts +3 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/TEventListenerObject.ts +5 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/Touch.ts +40 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/UIEvent.ts +32 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/AnimationEvent.ts +25 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/ClipboardEvent.ts +22 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/CloseEvent.ts +25 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/CookieChangeEvent.ts +25 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/CustomEvent.ts +53 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/ErrorEvent.ts +29 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/FocusEvent.ts +22 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/HashChangeEvent.ts +25 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/IAnimationEventInit.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/IClipboardEventInit.ts +6 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/ICloseEventInit.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/ICookieChangeEventInit.ts +10 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/ICustomEventInit.ts +5 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/IErrorEventInit.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/IFocusEventInit.ts +6 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/IHashChangeEventInit.ts +6 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/IInputEventInit.ts +9 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/IKeyboardEventInit.ts +23 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/IMediaQueryListEventInit.ts +6 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/IMediaQueryListInit.ts +6 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/IMessageEventInit.ts +11 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/IMouseEventInit.ts +21 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/IPointerEventInit.ts +19 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/IPopStateEventInit.ts +6 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/IProgressEventInit.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/IStorageEventInit.ts +10 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/ISubmitEventInit.ts +6 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/ITouchEventInit.ts +12 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/IWheelEventInit.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/InputEvent.ts +28 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/KeyboardEvent.ts +80 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/MediaQueryListEvent.ts +23 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/MediaStreamTrackEvent.ts +22 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/MessageEvent.ts +33 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/MouseEvent.ts +52 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/PointerEvent.ts +51 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/PopStateEvent.ts +23 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/ProgressEvent.ts +25 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/StorageEvent.ts +30 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/SubmitEvent.ts +22 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/TouchEvent.ts +34 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/WheelEvent.ts +30 -0
- package/vendor/happy-dom/packages/happy-dom/src/exception/DOMException.ts +21 -0
- package/vendor/happy-dom/packages/happy-dom/src/exception/DOMExceptionNameEnum.ts +23 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/AbortController.ts +25 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/AbortSignal.ts +182 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/Fetch.ts +1072 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/Headers.ts +177 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/ReadableStreamWrapper.ts +30 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/Request.ts +492 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/ResourceFetch.ts +190 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/Response.ts +439 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/SyncFetch.ts +717 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/cache/preflight/ICacheablePreflightRequest.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/cache/preflight/ICacheablePreflightResponse.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/cache/preflight/ICachedPreflightResponse.ts +5 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/cache/preflight/IPreflightResponseCache.ts +33 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/cache/preflight/PreflightResponseCache.ts +94 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/cache/response/CachedResponseStateEnum.ts +5 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/cache/response/ICacheableRequest.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/cache/response/ICacheableResponse.ts +11 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/cache/response/ICachedResponse.ts +40 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/cache/response/IResponseCache.ts +37 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/cache/response/IResponseCacheFileSystem.ts +18 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/cache/response/ResponseCache.ts +248 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/cache/response/ResponseCacheFileSystem.ts +175 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/certificate/FetchHTTPSCertificate.ts +52 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/data-uri/DataURIParser.ts +66 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/multipart/MultipartFormDataParser.ts +174 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/multipart/MultipartReader.ts +216 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/preload/PreloadEntry.ts +50 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/preload/PreloadUtility.ts +33 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/types/IFetchInterceptor.ts +60 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/types/IFetchRequestHeaders.ts +9 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/types/IRequestInit.ts +23 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/types/IResourceFetchResponse.ts +4 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/types/IResponseInit.ts +10 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/types/ISyncResponse.ts +18 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/types/IVirtualServer.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/types/THeadersInit.ts +3 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/types/TRequestBody.ts +14 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/types/TRequestCredentials.ts +1 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/types/TRequestInfo.ts +4 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/types/TRequestMode.ts +1 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/types/TRequestRedirect.ts +1 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/types/TRequestReferrerPolicy.ts +10 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/types/TResponseBody.ts +14 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/utilities/FetchBodyUtility.ts +284 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/utilities/FetchCORSUtility.ts +23 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/utilities/FetchRequestHeaderUtility.ts +141 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/utilities/FetchRequestReferrerUtility.ts +259 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/utilities/FetchRequestValidationUtility.ts +128 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/utilities/FetchResponseHeaderUtility.ts +48 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/utilities/FetchResponseRedirectUtility.ts +27 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/utilities/SyncFetchScriptBuilder.ts +77 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/utilities/VirtualServerUtility.ts +114 -0
- package/vendor/happy-dom/packages/happy-dom/src/file/Blob.ts +163 -0
- package/vendor/happy-dom/packages/happy-dom/src/file/File.ts +43 -0
- package/vendor/happy-dom/packages/happy-dom/src/file/FileReader.ts +211 -0
- package/vendor/happy-dom/packages/happy-dom/src/file/FileReaderEventTypeEnum.ts +9 -0
- package/vendor/happy-dom/packages/happy-dom/src/file/FileReaderFormatEnum.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/file/FileReaderReadyStateEnum.ts +6 -0
- package/vendor/happy-dom/packages/happy-dom/src/form-data/FormData.ts +291 -0
- package/vendor/happy-dom/packages/happy-dom/src/history/History.ts +220 -0
- package/vendor/happy-dom/packages/happy-dom/src/history/HistoryItemList.ts +72 -0
- package/vendor/happy-dom/packages/happy-dom/src/history/HistoryScrollRestorationEnum.ts +5 -0
- package/vendor/happy-dom/packages/happy-dom/src/history/IHistoryItem.ts +12 -0
- package/vendor/happy-dom/packages/happy-dom/src/html-parser/HTMLParser.ts +920 -0
- package/vendor/happy-dom/packages/happy-dom/src/html-serializer/HTMLSerializer.ts +172 -0
- package/vendor/happy-dom/packages/happy-dom/src/index.ts +495 -0
- package/vendor/happy-dom/packages/happy-dom/src/intersection-observer/IIntersectionObserverInit.ts +16 -0
- package/vendor/happy-dom/packages/happy-dom/src/intersection-observer/IntersectionObserver.ts +64 -0
- package/vendor/happy-dom/packages/happy-dom/src/intersection-observer/IntersectionObserverEntry.ts +26 -0
- package/vendor/happy-dom/packages/happy-dom/src/javascript/IJavaScriptCompiledResult.ts +9 -0
- package/vendor/happy-dom/packages/happy-dom/src/javascript/JavaScriptCompiler.ts +381 -0
- package/vendor/happy-dom/packages/happy-dom/src/location/Location.ts +319 -0
- package/vendor/happy-dom/packages/happy-dom/src/match-media/IMediaQueryRange.ts +5 -0
- package/vendor/happy-dom/packages/happy-dom/src/match-media/IMediaQueryRule.ts +4 -0
- package/vendor/happy-dom/packages/happy-dom/src/match-media/MediaQueryItem.ts +354 -0
- package/vendor/happy-dom/packages/happy-dom/src/match-media/MediaQueryList.ts +133 -0
- package/vendor/happy-dom/packages/happy-dom/src/match-media/MediaQueryParser.ts +113 -0
- package/vendor/happy-dom/packages/happy-dom/src/match-media/MediaQueryTypeEnum.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/module/CSSModule.ts +53 -0
- package/vendor/happy-dom/packages/happy-dom/src/module/ECMAScriptModule.ts +194 -0
- package/vendor/happy-dom/packages/happy-dom/src/module/ECMAScriptModuleCompiler.ts +961 -0
- package/vendor/happy-dom/packages/happy-dom/src/module/JSONModule.ts +58 -0
- package/vendor/happy-dom/packages/happy-dom/src/module/ModuleFactory.ts +148 -0
- package/vendor/happy-dom/packages/happy-dom/src/module/ModuleURLUtility.ts +199 -0
- package/vendor/happy-dom/packages/happy-dom/src/module/UnresolvedModule.ts +81 -0
- package/vendor/happy-dom/packages/happy-dom/src/module/enums/ECMAScriptModuleEvaluateStateEnum.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/module/types/IECMAScriptModuleCachedResult.ts +9 -0
- package/vendor/happy-dom/packages/happy-dom/src/module/types/IECMAScriptModuleCompiledResult.ts +19 -0
- package/vendor/happy-dom/packages/happy-dom/src/module/types/IECMAScriptModuleImport.ts +4 -0
- package/vendor/happy-dom/packages/happy-dom/src/module/types/IECMAScriptModuleInit.ts +10 -0
- package/vendor/happy-dom/packages/happy-dom/src/module/types/IModule.ts +20 -0
- package/vendor/happy-dom/packages/happy-dom/src/module/types/IModuleImportMap.ts +10 -0
- package/vendor/happy-dom/packages/happy-dom/src/module/types/IModuleImportMapRule.ts +4 -0
- package/vendor/happy-dom/packages/happy-dom/src/module/types/IModuleImportMapScope.ts +6 -0
- package/vendor/happy-dom/packages/happy-dom/src/module/types/IModuleInit.ts +12 -0
- package/vendor/happy-dom/packages/happy-dom/src/module/types/IResolveNodeModules.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/mutation-observer/IMutationListener.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/mutation-observer/IMutationObserverInit.ts +14 -0
- package/vendor/happy-dom/packages/happy-dom/src/mutation-observer/MutationObserver.ts +175 -0
- package/vendor/happy-dom/packages/happy-dom/src/mutation-observer/MutationObserverListener.ts +115 -0
- package/vendor/happy-dom/packages/happy-dom/src/mutation-observer/MutationRecord.ts +55 -0
- package/vendor/happy-dom/packages/happy-dom/src/mutation-observer/MutationTypeEnum.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/navigator/MimeType.ts +35 -0
- package/vendor/happy-dom/packages/happy-dom/src/navigator/MimeTypeArray.ts +48 -0
- package/vendor/happy-dom/packages/happy-dom/src/navigator/Navigator.ts +247 -0
- package/vendor/happy-dom/packages/happy-dom/src/navigator/Plugin.ts +61 -0
- package/vendor/happy-dom/packages/happy-dom/src/navigator/PluginArray.ts +58 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/NodeFactory.ts +38 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/attr/Attr.ts +119 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/character-data/CharacterData.ts +218 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/character-data/CharacterDataUtility.ts +68 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/child-node/ChildNodeUtility.ts +100 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/child-node/IChildNode.ts +29 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/child-node/INonDocumentTypeChildNode.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/child-node/NonDocumentChildNodeUtility.ts +37 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/comment/Comment.ts +36 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/document/Document.ts +2310 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/document/DocumentReadyStateEnum.ts +6 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/document/DocumentReadyStateManager.ts +52 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/document/VisibilityStateEnum.ts +6 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/document-fragment/DocumentFragment.ts +208 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/document-type/DocumentType.ts +70 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/element/Element.ts +1842 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/element/ElementEventAttributeUtility.ts +96 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/element/HTMLCollection.ts +228 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/element/NamedNodeMap.ts +274 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/element/NamedNodeMapProxyFactory.ts +127 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/element/THTMLCollectionListener.ts +6 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/element/TNamedNodeMapListener.ts +3 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-anchor-element/HTMLAnchorElement.ts +439 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-area-element/HTMLAreaElement.ts +426 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-audio-element/Audio.ts +28 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-audio-element/HTMLAudioElement.ts +10 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-base-element/HTMLBaseElement.ts +64 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-body-element/HTMLBodyElement.ts +161 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-br-element/HTMLBRElement.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-button-element/HTMLButtonElement.ts +406 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-canvas-element/CanvasCaptureMediaStreamTrack.ts +51 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-canvas-element/HTMLCanvasElement.ts +304 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-d-list-element/HTMLDListElement.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-data-element/HTMLDataElement.ts +25 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-data-list-element/HTMLDataListElement.ts +28 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-details-element/HTMLDetailsElement.ts +112 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-dialog-element/HTMLDialogElement.ts +104 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-div-element/HTMLDivElement.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-document/HTMLDocument.ts +82 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-element/HTMLElement.ts +1149 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-element/HTMLElementUtility.ts +119 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-embed-element/HTMLEmbedElement.ts +90 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-field-set-element/HTMLFieldSetElement.ts +165 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-form-element/HTMLFormControlsCollection.ts +35 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-form-element/HTMLFormElement.ts +675 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-form-element/RadioNodeList.ts +25 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-form-element/THTMLFormControlElement.ts +16 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-head-element/HTMLHeadElement.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-heading-element/HTMLHeadingElement.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-hr-element/HTMLHRElement.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-html-element/HTMLHtmlElement.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-hyperlink-element/HTMLHyperlinkElementUtility.ts +329 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-hyperlink-element/IHTMLHyperlinkElement.ts +19 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-iframe-element/HTMLIFrameElement.ts +460 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-image-element/HTMLImageElement.ts +500 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-image-element/Image.ts +33 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-input-element/FileList.ts +34 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-input-element/HTMLInputElement.ts +1550 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-input-element/HTMLInputElementDateUtility.ts +50 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-input-element/HTMLInputElementSelectionDirectionEnum.ts +6 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-input-element/HTMLInputElementSelectionModeEnum.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-input-element/HTMLInputElementValueSanitizer.ts +211 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-input-element/HTMLInputElementValueStepping.ts +92 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-label-element/HTMLLabelElement.ts +128 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-label-element/HTMLLabelElementUtility.ts +45 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-legend-element/HTMLLegendElement.ts +27 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-li-element/HTMLLIElement.ts +31 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-link-element/HTMLLinkElement.ts +501 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-map-element/HTMLMapElement.ts +47 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-media-element/HTMLMediaElement.ts +906 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-media-element/IMediaTrackCapabilities.ts +21 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-media-element/IMediaTrackSettings.ts +5 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-media-element/MediaStream.ts +114 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-media-element/MediaStreamTrack.ts +182 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-media-element/RemotePlayback.ts +47 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-media-element/TextTrack.ts +156 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-media-element/TextTrackCue.ts +51 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-media-element/TextTrackCueList.ts +37 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-media-element/TextTrackKindEnum.ts +9 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-media-element/TextTrackList.ts +182 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-media-element/TimeRanges.ts +73 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-media-element/VTTCue.ts +80 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-media-element/VTTRegion.ts +15 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-menu-element/HTMLMenuElement.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-meta-element/HTMLMetaElement.ts +80 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-meter-element/HTMLMeterElement.ts +216 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-mod-element/HTMLModElement.ts +54 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-o-list-element/HTMLOListElement.ts +83 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-object-element/HTMLObjectElement.ts +223 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-opt-group-element/HTMLOptGroupElement.ts +53 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-option-element/HTMLOptionElement.ts +192 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-output-element/HTMLOutputElement.ts +179 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-paragraph-element/HTMLParagraphElement.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-param-element/HTMLParamElement.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-picture-element/HTMLPictureElement.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-pre-element/HTMLPreElement.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-progress-element/HTMLProgressElement.ts +100 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-quote-element/HTMLQuoteElement.ts +36 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-script-element/HTMLScriptElement.ts +735 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-select-element/HTMLOptionsCollection.ts +69 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-select-element/HTMLSelectElement.ts +779 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-slot-element/HTMLSlotElement.ts +249 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-source-element/HTMLSourceElement.ts +148 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-span-element/HTMLSpanElement.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-style-element/HTMLStyleElement.ts +125 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-table-caption-element/HTMLTableCaptionElement.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-table-cell-element/HTMLTableCellElement.ts +125 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-table-col-element/HTMLTableColElement.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-table-element/HTMLTableElement.ts +343 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-table-row-element/HTMLTableRowElement.ts +149 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-table-section-element/HTMLTableSectionElement.ts +88 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-template-element/HTMLTemplateElement.ts +154 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-text-area-element/HTMLTextAreaElement.ts +649 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-time-element/HTMLTimeElement.ts +27 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-title-element/HTMLTitleElement.ts +48 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-track-element/HTMLTrackElement.ts +164 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-u-list-element/HTMLUListElement.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-unknown-element/HTMLUnknownElement.ts +9 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-video-element/HTMLVideoElement.ts +10 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/node/ICachedComputedStyleResult.ts +6 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/node/ICachedElementByIdResult.ts +6 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/node/ICachedElementByTagNameResult.ts +6 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/node/ICachedElementsByTagNameResult.ts +6 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/node/ICachedMatchesResult.ts +6 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/node/ICachedQuerySelectorAllResult.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/node/ICachedQuerySelectorResult.ts +6 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/node/ICachedResult.ts +3 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/node/ICachedStyleResult.ts +6 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/node/Node.ts +1373 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/node/NodeDocumentPositionEnum.ts +10 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/node/NodeList.ts +224 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/node/NodeTypeEnum.ts +13 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/node/NodeUtility.ts +330 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/node/TNodeListListener.ts +1 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/parent-node/IParentNode.ts +109 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/parent-node/ParentNodeUtility.ts +334 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/processing-instruction/ProcessingInstruction.ts +22 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/shadow-root/ShadowRoot.ts +290 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-animate-element/SVGAnimateElement.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-animate-motion-element/SVGAnimateMotionElement.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-animate-transform-element/SVGAnimateTransformElement.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-animation-element/SVGAnimationElement.ts +94 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-circle-element/SVGCircleElement.ts +72 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-clip-path-element/SVGClipPathElement.ts +34 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-component-transfer-function-element/SVGComponentTransferFunctionElement.ts +167 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-defs-element/SVGDefsElement.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-desc-element/SVGDescElement.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-element/SVGElement.ts +828 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-ellipse-element/SVGEllipseElement.ts +92 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-fe-blend-element/SVGFEBlendElement.ts +192 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-fe-color-matrix-element/SVGFEColorMatrixElement.ts +204 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-fe-component-transfer-element/SVGFEComponentTransferElement.ts +133 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-fe-composite-element/SVGFECompositeElement.ts +186 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-fe-convolve-matrix-element/SVGFEConvolveMatrixElement.ts +366 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-fe-diffuse-lighting-element/SVGFEDiffuseLightingElement.ts +214 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-fe-displacement-map-element/SVGFEDisplacementMapElement.ts +226 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-fe-distant-light-element/SVGFEDistantLightElement.ts +52 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-fe-drop-shadow-element/SVGFEDropShadowElement.ts +227 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-fe-flood-element/SVGFEFloodElement.ts +113 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-fe-func-a-element/SVGFEFuncAElement.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-fe-func-b-element/SVGFEFuncBElement.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-fe-func-g-element/SVGFEFuncGElement.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-fe-func-r-element/SVGFEFuncRElement.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-fe-gaussian-blur-element/SVGFEGaussianBlurElement.ts +214 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-fe-image-element/SVGFEImageElement.ts +173 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-fe-merge-element/SVGFEMergeElement.ts +113 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-fe-merge-node-element/SVGFEMergeNodeElement.ts +32 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-fe-morphology-element/SVGFEMorphologyElement.ts +202 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-fe-offset-element/SVGFEOffsetElement.ts +174 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-fe-point-light-element/SVGFEPointLightElement.ts +72 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-fe-specular-lighting-element/SVGFESpecularLightingElement.ts +237 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-fe-spot-light-element/SVGFESpotLightElement.ts +173 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-fe-tile-element/SVGFETileElement.ts +133 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-fe-turbulence-element/SVGFETurbulenceElement.ts +249 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-filter-element/SVGFilterElement.ts +158 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-foreign-object-element/SVGForeignObjectElement.ts +92 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-g-element/SVGGElement.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-geometry-element/SVGGeometryElement.ts +94 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-gradient-element/SVGGradientElement.ts +104 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-graphics-element/SVGGraphicsElement.ts +134 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-image-element/SVGImageElement.ts +188 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-line-element/SVGLineElement.ts +92 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-linear-gradient-element/SVGLinearGradientElement.ts +92 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-m-path-element/SVGMPathElement.ts +32 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-marker-element/SVGMarkerElement.ts +230 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-mask-element/SVGMaskElement.ts +137 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-metadata-element/SVGMetadataElement.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-path-element/SVGPathElement.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-pattern-element/SVGPatternElement.ts +179 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-polygon-element/SVGPolygonElement.ts +53 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-polyline-element/SVGPolylineElement.ts +53 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-radial-gradient-element/SVGRadialGradientElement.ts +112 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-rect-element/SVGRectElement.ts +132 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-script-element/SVGScriptElement.ts +50 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-set-element/SVGSetElement.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-stop-element/SVGStopElement.ts +32 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-style-element/SVGStyleElement.ts +143 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-svg-element/SVGSVGElement.ts +601 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-switch-element/SVGSwitchElement.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-symbol-element/SVGSymbolElement.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-t-span-element/SVGTSpanElement.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-text-content-element/SVGTextContentElement.ts +143 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-text-element/SVGTextElement.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-text-path-element/SVGTextPathElement.ts +106 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-text-positioning-element/SVGTextPositioningElement.ts +113 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-title-element/SVGTitleElement.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-use-element/SVGUseElement.ts +113 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-view-element/SVGViewElement.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/text/Text.ts +154 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/xml-document/XMLDocument.ts +10 -0
- package/vendor/happy-dom/packages/happy-dom/src/permissions/PermissionNameEnum.ts +32 -0
- package/vendor/happy-dom/packages/happy-dom/src/permissions/PermissionStatus.ts +23 -0
- package/vendor/happy-dom/packages/happy-dom/src/permissions/Permissions.ts +59 -0
- package/vendor/happy-dom/packages/happy-dom/src/query-selector/ISelectorAttribute.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/query-selector/ISelectorMatch.ts +3 -0
- package/vendor/happy-dom/packages/happy-dom/src/query-selector/ISelectorPseudo.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/query-selector/QuerySelector.ts +849 -0
- package/vendor/happy-dom/packages/happy-dom/src/query-selector/SelectorCombinatorEnum.ts +9 -0
- package/vendor/happy-dom/packages/happy-dom/src/query-selector/SelectorItem.ts +575 -0
- package/vendor/happy-dom/packages/happy-dom/src/query-selector/SelectorParser.ts +699 -0
- package/vendor/happy-dom/packages/happy-dom/src/query-selector/TGlobalMatchFunction.ts +12 -0
- package/vendor/happy-dom/packages/happy-dom/src/range/IRangeBoundaryPoint.ts +9 -0
- package/vendor/happy-dom/packages/happy-dom/src/range/Range.ts +1161 -0
- package/vendor/happy-dom/packages/happy-dom/src/range/RangeHowEnum.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/range/RangeUtility.ts +118 -0
- package/vendor/happy-dom/packages/happy-dom/src/resize-observer/ResizeObserver.ts +33 -0
- package/vendor/happy-dom/packages/happy-dom/src/screen/Screen.ts +19 -0
- package/vendor/happy-dom/packages/happy-dom/src/screen/ScreenDetailed.ts +17 -0
- package/vendor/happy-dom/packages/happy-dom/src/screen/ScreenDetails.ts +27 -0
- package/vendor/happy-dom/packages/happy-dom/src/selection/Selection.ts +556 -0
- package/vendor/happy-dom/packages/happy-dom/src/selection/SelectionDirectionEnum.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/storage/Storage.ts +149 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGAngle.ts +310 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGAngleTypeEnum.ts +9 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGAnimatedAngle.ts +100 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGAnimatedBoolean.ts +80 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGAnimatedEnumeration.ts +119 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGAnimatedInteger.ts +97 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGAnimatedLength.ts +100 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGAnimatedLengthList.ts +101 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGAnimatedNumber.ts +101 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGAnimatedNumberList.ts +101 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGAnimatedPreserveAspectRatio.ts +100 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGAnimatedRect.ts +100 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGAnimatedString.ts +83 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGAnimatedTransformList.ts +101 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGLength.ts +375 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGLengthList.ts +489 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGLengthTypeEnum.ts +15 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGMatrix.ts +429 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGNumber.ts +83 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGNumberList.ts +522 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGPoint.ts +114 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGPointList.ts +526 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGPreserveAspectRatio.ts +176 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGPreserveAspectRatioAlignEnum.ts +15 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGPreserveAspectRatioMeetOrSliceEnum.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGRect.ts +200 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGStringList.ts +422 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGTransform.ts +369 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGTransformList.ts +531 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGTransformTypeEnum.ts +11 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGUnitTypes.ts +26 -0
- package/vendor/happy-dom/packages/happy-dom/src/tree-walker/NodeFilter.ts +18 -0
- package/vendor/happy-dom/packages/happy-dom/src/tree-walker/NodeFilterMask.ts +28 -0
- package/vendor/happy-dom/packages/happy-dom/src/tree-walker/NodeIterator.ts +85 -0
- package/vendor/happy-dom/packages/happy-dom/src/tree-walker/TNodeFilter.ts +3 -0
- package/vendor/happy-dom/packages/happy-dom/src/tree-walker/TreeWalker.ts +339 -0
- package/vendor/happy-dom/packages/happy-dom/src/url/URL.ts +45 -0
- package/vendor/happy-dom/packages/happy-dom/src/utilities/AttributeUtility.ts +43 -0
- package/vendor/happy-dom/packages/happy-dom/src/utilities/ClassMethodBinder.ts +71 -0
- package/vendor/happy-dom/packages/happy-dom/src/utilities/StringUtility.ts +47 -0
- package/vendor/happy-dom/packages/happy-dom/src/utilities/XMLEncodeUtility.ts +166 -0
- package/vendor/happy-dom/packages/happy-dom/src/validity-state/ValidityState.ts +234 -0
- package/vendor/happy-dom/packages/happy-dom/src/version.ts +1 -0
- package/vendor/happy-dom/packages/happy-dom/src/web-socket/WebSocket.ts +408 -0
- package/vendor/happy-dom/packages/happy-dom/src/web-socket/WebSocketReadyStateEnum.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/window/BrowserWindow.ts +3074 -0
- package/vendor/happy-dom/packages/happy-dom/src/window/CrossOriginBrowserWindow.ts +152 -0
- package/vendor/happy-dom/packages/happy-dom/src/window/DetachedWindowAPI.ts +133 -0
- package/vendor/happy-dom/packages/happy-dom/src/window/GlobalWindow.ts +90 -0
- package/vendor/happy-dom/packages/happy-dom/src/window/INodeJSGlobal.ts +76 -0
- package/vendor/happy-dom/packages/happy-dom/src/window/IOptionalTimerLoopsLimit.ts +4 -0
- package/vendor/happy-dom/packages/happy-dom/src/window/IScrollToOptions.ts +5 -0
- package/vendor/happy-dom/packages/happy-dom/src/window/ITimerLoopsLimit.ts +4 -0
- package/vendor/happy-dom/packages/happy-dom/src/window/VMGlobalPropertyScript.ts +59 -0
- package/vendor/happy-dom/packages/happy-dom/src/window/Window.ts +67 -0
- package/vendor/happy-dom/packages/happy-dom/src/window/WindowBrowserContext.ts +117 -0
- package/vendor/happy-dom/packages/happy-dom/src/window/WindowContextClassExtender.ts +288 -0
- package/vendor/happy-dom/packages/happy-dom/src/window/WindowPageOpenUtility.ts +200 -0
- package/vendor/happy-dom/packages/happy-dom/src/xml-http-request/XMLHttpRequest.ts +577 -0
- package/vendor/happy-dom/packages/happy-dom/src/xml-http-request/XMLHttpRequestEventTarget.ts +88 -0
- package/vendor/happy-dom/packages/happy-dom/src/xml-http-request/XMLHttpRequestReadyStateEnum.ts +9 -0
- package/vendor/happy-dom/packages/happy-dom/src/xml-http-request/XMLHttpRequestResponseDataParser.ts +70 -0
- package/vendor/happy-dom/packages/happy-dom/src/xml-http-request/XMLHttpRequestUpload.ts +6 -0
- package/vendor/happy-dom/packages/happy-dom/src/xml-http-request/XMLHttpResponseTypeEnum.ts +9 -0
- package/vendor/happy-dom/packages/happy-dom/src/xml-parser/XMLParser.ts +744 -0
- package/vendor/happy-dom/packages/happy-dom/src/xml-serializer/XMLSerializer.ts +280 -0
- package/vendor/happy-dom/turbo.json +52 -0
- package/vendor/ses/LICENSE +201 -0
- package/vendor/ses/LICENSE-aura +16 -0
- package/vendor/ses/LICENSE-caja +13 -0
- package/vendor/ses/LICENSE-corejs +19 -0
- package/vendor/ses/LICENSE-v8 +9 -0
- package/vendor/ses/README.md +968 -0
- package/vendor/ses/dist/ses.mjs +15219 -0
- package/vendor/ses/package.json +142 -0
- package/vendor/wasmpeg/LICENSE +501 -0
- package/vendor/wasmpeg/NOTICE +30 -0
- package/vendor/wasmpeg/VENDORING.md +35 -0
- package/vendor/wasmpeg/dist/cpu.js +2 -0
- package/vendor/wasmpeg/dist/cpu.wasm +0 -0
- package/vendor/wasmpeg/package.json +45 -0
- package/vendor/wasmpeg/source-v1.0.1.tar.gz +0 -0
- package/vendor/wasmpeg/src/js/exec.mjs +478 -0
- package/vendor/wasmpeg/src/js/ffmpeg.js +94 -0
- package/vendor/wasmpeg/src/js/formats.js +84 -0
- package/vendor/wasmpeg/src/js/gpu.js +480 -0
- package/vendor/wasmpeg/src/js/index.d.ts +154 -0
- package/vendor/wasmpeg/src/js/index.js +7 -0
- package/vendor/wasmpeg/src/js/wasmpeg.mjs +221 -0
|
@@ -0,0 +1,1161 @@
|
|
|
1
|
+
import type Node from '../nodes/node/Node.js';
|
|
2
|
+
import * as PropertySymbol from '../PropertySymbol.js';
|
|
3
|
+
import type Document from '../nodes/document/Document.js';
|
|
4
|
+
import type DocumentFragment from '../nodes/document-fragment/DocumentFragment.js';
|
|
5
|
+
import DOMRect from '../dom/DOMRect.js';
|
|
6
|
+
import RangeHowEnum from './RangeHowEnum.js';
|
|
7
|
+
import DOMExceptionNameEnum from '../exception/DOMExceptionNameEnum.js';
|
|
8
|
+
import RangeUtility from './RangeUtility.js';
|
|
9
|
+
import NodeTypeEnum from '../nodes/node/NodeTypeEnum.js';
|
|
10
|
+
import NodeUtility from '../nodes/node/NodeUtility.js';
|
|
11
|
+
import type Comment from '../nodes/comment/Comment.js';
|
|
12
|
+
import type Text from '../nodes/text/Text.js';
|
|
13
|
+
import DOMRectList from '../dom/DOMRectList.js';
|
|
14
|
+
import type IRangeBoundaryPoint from './IRangeBoundaryPoint.js';
|
|
15
|
+
import type BrowserWindow from '../window/BrowserWindow.js';
|
|
16
|
+
import HTMLParser from '../html-parser/HTMLParser.js';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Range.
|
|
20
|
+
*
|
|
21
|
+
* Based on logic from:
|
|
22
|
+
* https://github.com/jsdom/jsdom/blob/master/lib/jsdom/living/range/Range-impl.js
|
|
23
|
+
*
|
|
24
|
+
* Reference:
|
|
25
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Range.
|
|
26
|
+
*/
|
|
27
|
+
export default class Range {
|
|
28
|
+
// Injected by WindowContextClassExtender
|
|
29
|
+
protected declare [PropertySymbol.window]: BrowserWindow;
|
|
30
|
+
|
|
31
|
+
public static readonly END_TO_END: number = RangeHowEnum.endToEnd;
|
|
32
|
+
public static readonly END_TO_START: number = RangeHowEnum.endToStart;
|
|
33
|
+
public static readonly START_TO_END: number = RangeHowEnum.startToEnd;
|
|
34
|
+
public static readonly START_TO_START: number = RangeHowEnum.startToStart;
|
|
35
|
+
public readonly END_TO_END: number = RangeHowEnum.endToEnd;
|
|
36
|
+
public readonly END_TO_START: number = RangeHowEnum.endToStart;
|
|
37
|
+
public readonly START_TO_END: number = RangeHowEnum.startToEnd;
|
|
38
|
+
public readonly START_TO_START: number = RangeHowEnum.startToStart;
|
|
39
|
+
public [PropertySymbol.start]: IRangeBoundaryPoint;
|
|
40
|
+
public [PropertySymbol.end]: IRangeBoundaryPoint;
|
|
41
|
+
public readonly [PropertySymbol.ownerDocument]: Document;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Constructor.
|
|
45
|
+
*
|
|
46
|
+
* @param window Window.
|
|
47
|
+
*/
|
|
48
|
+
constructor() {
|
|
49
|
+
const window = this[PropertySymbol.window];
|
|
50
|
+
|
|
51
|
+
if (!window) {
|
|
52
|
+
throw new TypeError(
|
|
53
|
+
`Failed to construct '${this.constructor.name}': '${this.constructor.name}' was constructed outside a Window context.`
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
this[PropertySymbol.ownerDocument] = window.document;
|
|
58
|
+
this[PropertySymbol.start] = { node: window.document, offset: 0 };
|
|
59
|
+
this[PropertySymbol.end] = { node: window.document, offset: 0 };
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Returns start container.
|
|
64
|
+
*
|
|
65
|
+
* @see https://dom.spec.whatwg.org/#dom-range-startcontainer
|
|
66
|
+
* @returns Start container.
|
|
67
|
+
*/
|
|
68
|
+
public get startContainer(): Node {
|
|
69
|
+
return this[PropertySymbol.start].node;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Returns end container.
|
|
74
|
+
*
|
|
75
|
+
* @see https://dom.spec.whatwg.org/#dom-range-endcontainer
|
|
76
|
+
* @returns End container.
|
|
77
|
+
*/
|
|
78
|
+
public get endContainer(): Node {
|
|
79
|
+
return this[PropertySymbol.end].node;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Returns start offset.
|
|
84
|
+
*
|
|
85
|
+
* @see https://dom.spec.whatwg.org/#dom-range-startoffset
|
|
86
|
+
* @returns Start offset.
|
|
87
|
+
*/
|
|
88
|
+
public get startOffset(): number {
|
|
89
|
+
if (this[PropertySymbol.start].offset > 0) {
|
|
90
|
+
const length = NodeUtility.getNodeLength(this[PropertySymbol.start].node);
|
|
91
|
+
if (this[PropertySymbol.start].offset > length) {
|
|
92
|
+
this[PropertySymbol.start].offset = length;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return this[PropertySymbol.start].offset;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Returns end offset.
|
|
101
|
+
*
|
|
102
|
+
* @see https://dom.spec.whatwg.org/#dom-range-endoffset
|
|
103
|
+
* @returns End offset.
|
|
104
|
+
*/
|
|
105
|
+
public get endOffset(): number {
|
|
106
|
+
if (this[PropertySymbol.end].offset > 0) {
|
|
107
|
+
const length = NodeUtility.getNodeLength(this[PropertySymbol.end].node);
|
|
108
|
+
if (this[PropertySymbol.end].offset > length) {
|
|
109
|
+
this[PropertySymbol.end].offset = length;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return this[PropertySymbol.end].offset;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Returns a boolean value indicating whether the range's start and end points are at the same position.
|
|
118
|
+
*
|
|
119
|
+
* @see https://dom.spec.whatwg.org/#dom-range-collapsed
|
|
120
|
+
* @returns Collapsed.
|
|
121
|
+
*/
|
|
122
|
+
public get collapsed(): boolean {
|
|
123
|
+
return (
|
|
124
|
+
this[PropertySymbol.start].node === this[PropertySymbol.end].node &&
|
|
125
|
+
this.startOffset === this.endOffset
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Returns the deepest Node that contains the startContainer and endContainer nodes.
|
|
131
|
+
*
|
|
132
|
+
* @see https://dom.spec.whatwg.org/#dom-range-commonancestorcontainer
|
|
133
|
+
* @returns Node.
|
|
134
|
+
*/
|
|
135
|
+
public get commonAncestorContainer(): Node | null {
|
|
136
|
+
let container: Node | null = this[PropertySymbol.start].node;
|
|
137
|
+
|
|
138
|
+
while (container) {
|
|
139
|
+
if (NodeUtility.isInclusiveAncestor(container, this[PropertySymbol.end].node)) {
|
|
140
|
+
return container;
|
|
141
|
+
}
|
|
142
|
+
container = container[PropertySymbol.parentNode];
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
return null;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Returns -1, 0, or 1 depending on whether the referenceNode is before, the same as, or after the Range.
|
|
150
|
+
*
|
|
151
|
+
* @see https://dom.spec.whatwg.org/#dom-range-collapse
|
|
152
|
+
* @param toStart A boolean value: true collapses the Range to its start, false to its end. If omitted, it defaults to false.
|
|
153
|
+
*/
|
|
154
|
+
public collapse(toStart = false): void {
|
|
155
|
+
if (toStart) {
|
|
156
|
+
this[PropertySymbol.end] = Object.assign({}, this[PropertySymbol.start]);
|
|
157
|
+
} else {
|
|
158
|
+
this[PropertySymbol.start] = Object.assign({}, this[PropertySymbol.end]);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Compares the boundary points of the Range with those of another range.
|
|
164
|
+
*
|
|
165
|
+
* @see https://dom.spec.whatwg.org/#dom-range-compareboundarypoints
|
|
166
|
+
* @param how How.
|
|
167
|
+
* @param sourceRange Range.
|
|
168
|
+
* @returns A number, -1, 0, or 1, indicating whether the corresponding boundary-point of the Range is respectively before, equal to, or after the corresponding boundary-point of sourceRange.
|
|
169
|
+
*/
|
|
170
|
+
public compareBoundaryPoints(how: RangeHowEnum, sourceRange: Range): number {
|
|
171
|
+
if (
|
|
172
|
+
how !== RangeHowEnum.startToStart &&
|
|
173
|
+
how !== RangeHowEnum.startToEnd &&
|
|
174
|
+
how !== RangeHowEnum.endToEnd &&
|
|
175
|
+
how !== RangeHowEnum.endToStart
|
|
176
|
+
) {
|
|
177
|
+
throw new this[PropertySymbol.window].DOMException(
|
|
178
|
+
`The comparison method provided must be one of '${RangeHowEnum.startToStart}', '${RangeHowEnum.startToEnd}', '${RangeHowEnum.endToEnd}' or '${RangeHowEnum.endToStart}'.`,
|
|
179
|
+
DOMExceptionNameEnum.notSupportedError
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
if (this[PropertySymbol.ownerDocument] !== sourceRange[PropertySymbol.ownerDocument]) {
|
|
184
|
+
throw new this[PropertySymbol.window].DOMException(
|
|
185
|
+
`The two Ranges are not in the same tree.`,
|
|
186
|
+
DOMExceptionNameEnum.wrongDocumentError
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
const thisPoint: { node: Node | null; offset: number } = {
|
|
191
|
+
node: null,
|
|
192
|
+
offset: 0
|
|
193
|
+
};
|
|
194
|
+
const sourcePoint: { node: Node | null; offset: number } = {
|
|
195
|
+
node: null,
|
|
196
|
+
offset: 0
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
switch (how) {
|
|
200
|
+
case RangeHowEnum.startToStart:
|
|
201
|
+
thisPoint.node = this[PropertySymbol.start].node;
|
|
202
|
+
thisPoint.offset = this.startOffset;
|
|
203
|
+
sourcePoint.node = sourceRange[PropertySymbol.start].node;
|
|
204
|
+
sourcePoint.offset = sourceRange.startOffset;
|
|
205
|
+
break;
|
|
206
|
+
case RangeHowEnum.startToEnd:
|
|
207
|
+
thisPoint.node = this[PropertySymbol.end].node;
|
|
208
|
+
thisPoint.offset = this.endOffset;
|
|
209
|
+
sourcePoint.node = sourceRange[PropertySymbol.start].node;
|
|
210
|
+
sourcePoint.offset = sourceRange.startOffset;
|
|
211
|
+
break;
|
|
212
|
+
case RangeHowEnum.endToEnd:
|
|
213
|
+
thisPoint.node = this[PropertySymbol.end].node;
|
|
214
|
+
thisPoint.offset = this.endOffset;
|
|
215
|
+
sourcePoint.node = sourceRange[PropertySymbol.end].node;
|
|
216
|
+
sourcePoint.offset = sourceRange.endOffset;
|
|
217
|
+
break;
|
|
218
|
+
case RangeHowEnum.endToStart:
|
|
219
|
+
thisPoint.node = this[PropertySymbol.start].node;
|
|
220
|
+
thisPoint.offset = this.startOffset;
|
|
221
|
+
sourcePoint.node = sourceRange[PropertySymbol.end].node;
|
|
222
|
+
sourcePoint.offset = sourceRange.endOffset;
|
|
223
|
+
break;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
return RangeUtility.compareBoundaryPointsPosition(
|
|
227
|
+
<IRangeBoundaryPoint>thisPoint,
|
|
228
|
+
<IRangeBoundaryPoint>sourcePoint
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Returns -1, 0, or 1 depending on whether the referenceNode is before, the same as, or after the Range.
|
|
234
|
+
*
|
|
235
|
+
* @see https://dom.spec.whatwg.org/#dom-range-comparepoint
|
|
236
|
+
* @param node Reference node.
|
|
237
|
+
* @param offset Offset.
|
|
238
|
+
* @returns -1,0, or 1.
|
|
239
|
+
*/
|
|
240
|
+
public comparePoint(node: Node, offset: number): number {
|
|
241
|
+
if (node[PropertySymbol.ownerDocument] !== this[PropertySymbol.ownerDocument]) {
|
|
242
|
+
throw new this[PropertySymbol.window].DOMException(
|
|
243
|
+
`The two Ranges are not in the same tree.`,
|
|
244
|
+
DOMExceptionNameEnum.wrongDocumentError
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
RangeUtility.validateBoundaryPoint({ node, offset });
|
|
249
|
+
|
|
250
|
+
const boundaryPoint = { node, offset };
|
|
251
|
+
|
|
252
|
+
if (
|
|
253
|
+
RangeUtility.compareBoundaryPointsPosition(boundaryPoint, {
|
|
254
|
+
node: this[PropertySymbol.start].node,
|
|
255
|
+
offset: this.startOffset
|
|
256
|
+
}) === -1
|
|
257
|
+
) {
|
|
258
|
+
return -1;
|
|
259
|
+
} else if (
|
|
260
|
+
RangeUtility.compareBoundaryPointsPosition(boundaryPoint, {
|
|
261
|
+
node: this[PropertySymbol.end].node,
|
|
262
|
+
offset: this.endOffset
|
|
263
|
+
}) === 1
|
|
264
|
+
) {
|
|
265
|
+
return 1;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
return 0;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Returns a DocumentFragment copying the objects of type Node included in the Range.
|
|
273
|
+
*
|
|
274
|
+
* @see https://dom.spec.whatwg.org/#concept-range-clone
|
|
275
|
+
* @returns Document fragment.
|
|
276
|
+
*/
|
|
277
|
+
public cloneContents(): DocumentFragment {
|
|
278
|
+
const window = this[PropertySymbol.window];
|
|
279
|
+
const fragment = this[PropertySymbol.ownerDocument].createDocumentFragment();
|
|
280
|
+
const startOffset = this.startOffset;
|
|
281
|
+
const endOffset = this.endOffset;
|
|
282
|
+
|
|
283
|
+
if (this.collapsed) {
|
|
284
|
+
return fragment;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
if (
|
|
288
|
+
this[PropertySymbol.start].node === this[PropertySymbol.end].node &&
|
|
289
|
+
(this[PropertySymbol.start].node[PropertySymbol.nodeType] === NodeTypeEnum.textNode ||
|
|
290
|
+
this[PropertySymbol.start].node[PropertySymbol.nodeType] ===
|
|
291
|
+
NodeTypeEnum.processingInstructionNode ||
|
|
292
|
+
this[PropertySymbol.start].node[PropertySymbol.nodeType] === NodeTypeEnum.commentNode)
|
|
293
|
+
) {
|
|
294
|
+
const clone = (<Text | Comment>this[PropertySymbol.start].node).cloneNode(false);
|
|
295
|
+
clone[PropertySymbol.data] = clone.substringData(startOffset, endOffset - startOffset);
|
|
296
|
+
fragment.appendChild(clone);
|
|
297
|
+
return fragment;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
let commonAncestor = this[PropertySymbol.start].node;
|
|
301
|
+
while (!NodeUtility.isInclusiveAncestor(commonAncestor, this[PropertySymbol.end].node)) {
|
|
302
|
+
commonAncestor = commonAncestor[PropertySymbol.parentNode]!;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
let firstPartialContainedChild = null;
|
|
306
|
+
if (
|
|
307
|
+
!NodeUtility.isInclusiveAncestor(
|
|
308
|
+
this[PropertySymbol.start].node,
|
|
309
|
+
this[PropertySymbol.end].node
|
|
310
|
+
)
|
|
311
|
+
) {
|
|
312
|
+
let candidate = commonAncestor.firstChild!;
|
|
313
|
+
while (!firstPartialContainedChild) {
|
|
314
|
+
if (RangeUtility.isPartiallyContained(candidate, this)) {
|
|
315
|
+
firstPartialContainedChild = candidate;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
candidate = candidate.nextSibling!;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
let lastPartiallyContainedChild = null;
|
|
323
|
+
if (
|
|
324
|
+
!NodeUtility.isInclusiveAncestor(
|
|
325
|
+
this[PropertySymbol.end].node,
|
|
326
|
+
this[PropertySymbol.start].node
|
|
327
|
+
)
|
|
328
|
+
) {
|
|
329
|
+
let candidate = commonAncestor.lastChild!;
|
|
330
|
+
while (!lastPartiallyContainedChild) {
|
|
331
|
+
if (RangeUtility.isPartiallyContained(candidate, this)) {
|
|
332
|
+
lastPartiallyContainedChild = candidate;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
candidate = candidate.previousSibling!;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
const containedChildren = [];
|
|
340
|
+
|
|
341
|
+
for (const node of (<Node>commonAncestor)[PropertySymbol.nodeArray]) {
|
|
342
|
+
if (RangeUtility.isContained(node, this)) {
|
|
343
|
+
if (node[PropertySymbol.nodeType] === NodeTypeEnum.documentTypeNode) {
|
|
344
|
+
throw new window.DOMException(
|
|
345
|
+
'Invalid document type element.',
|
|
346
|
+
DOMExceptionNameEnum.hierarchyRequestError
|
|
347
|
+
);
|
|
348
|
+
}
|
|
349
|
+
containedChildren.push(node);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
if (
|
|
354
|
+
firstPartialContainedChild !== null &&
|
|
355
|
+
(firstPartialContainedChild[PropertySymbol.nodeType] === NodeTypeEnum.textNode ||
|
|
356
|
+
firstPartialContainedChild[PropertySymbol.nodeType] ===
|
|
357
|
+
NodeTypeEnum.processingInstructionNode ||
|
|
358
|
+
firstPartialContainedChild[PropertySymbol.nodeType] === NodeTypeEnum.commentNode)
|
|
359
|
+
) {
|
|
360
|
+
const clone = (<Text | Comment>this[PropertySymbol.start].node).cloneNode(false);
|
|
361
|
+
clone[PropertySymbol.data] = clone.substringData(
|
|
362
|
+
startOffset,
|
|
363
|
+
NodeUtility.getNodeLength(this[PropertySymbol.start].node) - startOffset
|
|
364
|
+
);
|
|
365
|
+
|
|
366
|
+
fragment.appendChild(clone);
|
|
367
|
+
} else if (firstPartialContainedChild !== null) {
|
|
368
|
+
const clone = firstPartialContainedChild.cloneNode();
|
|
369
|
+
fragment.appendChild(clone);
|
|
370
|
+
|
|
371
|
+
const subRange = new window.Range();
|
|
372
|
+
subRange[PropertySymbol.start].node = this[PropertySymbol.start].node;
|
|
373
|
+
subRange[PropertySymbol.start].offset = startOffset;
|
|
374
|
+
subRange[PropertySymbol.end].node = firstPartialContainedChild;
|
|
375
|
+
subRange[PropertySymbol.end].offset = NodeUtility.getNodeLength(firstPartialContainedChild);
|
|
376
|
+
|
|
377
|
+
const subDocumentFragment = subRange.cloneContents();
|
|
378
|
+
clone.appendChild(subDocumentFragment);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
for (const containedChild of containedChildren) {
|
|
382
|
+
const clone = containedChild.cloneNode(true);
|
|
383
|
+
fragment.appendChild(clone);
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
if (
|
|
387
|
+
lastPartiallyContainedChild !== null &&
|
|
388
|
+
(lastPartiallyContainedChild[PropertySymbol.nodeType] === NodeTypeEnum.textNode ||
|
|
389
|
+
lastPartiallyContainedChild[PropertySymbol.nodeType] ===
|
|
390
|
+
NodeTypeEnum.processingInstructionNode ||
|
|
391
|
+
lastPartiallyContainedChild[PropertySymbol.nodeType] === NodeTypeEnum.commentNode)
|
|
392
|
+
) {
|
|
393
|
+
const clone = (<Text | Comment>this[PropertySymbol.end].node).cloneNode(false);
|
|
394
|
+
clone[PropertySymbol.data] = clone.substringData(0, endOffset);
|
|
395
|
+
|
|
396
|
+
fragment.appendChild(clone);
|
|
397
|
+
} else if (lastPartiallyContainedChild !== null) {
|
|
398
|
+
const clone = lastPartiallyContainedChild.cloneNode(false);
|
|
399
|
+
fragment.appendChild(clone);
|
|
400
|
+
|
|
401
|
+
const subRange = new window.Range();
|
|
402
|
+
subRange[PropertySymbol.start].node = lastPartiallyContainedChild;
|
|
403
|
+
subRange[PropertySymbol.start].offset = 0;
|
|
404
|
+
subRange[PropertySymbol.end].node = this[PropertySymbol.end].node;
|
|
405
|
+
subRange[PropertySymbol.end].offset = endOffset;
|
|
406
|
+
|
|
407
|
+
const subFragment = subRange.cloneContents();
|
|
408
|
+
clone.appendChild(subFragment);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
return fragment;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* Returns a Range object with boundary points identical to the cloned Range.
|
|
416
|
+
*
|
|
417
|
+
* @see https://dom.spec.whatwg.org/#dom-range-clonerange
|
|
418
|
+
* @returns Range.
|
|
419
|
+
*/
|
|
420
|
+
public cloneRange(): Range {
|
|
421
|
+
const clone = new this[PropertySymbol.window].Range();
|
|
422
|
+
|
|
423
|
+
clone[PropertySymbol.start].node = this[PropertySymbol.start].node;
|
|
424
|
+
clone[PropertySymbol.start].offset = this[PropertySymbol.start].offset;
|
|
425
|
+
clone[PropertySymbol.end].node = this[PropertySymbol.end].node;
|
|
426
|
+
clone[PropertySymbol.end].offset = this[PropertySymbol.end].offset;
|
|
427
|
+
|
|
428
|
+
return clone;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* Returns a DocumentFragment by invoking the HTML fragment parsing algorithm or the XML fragment parsing algorithm with the start of the range (the parent of the selected node) as the context node. The HTML fragment parsing algorithm is used if the range belongs to a Document whose HTMLness bit is set. In the HTML case, if the context node would be html, for historical reasons the fragment parsing algorithm is invoked with body as the context instead.
|
|
433
|
+
*
|
|
434
|
+
* @see https://w3c.github.io/DOM-Parsing/#dfn-fragment-parsing-algorithm
|
|
435
|
+
* @param tagString Tag string.
|
|
436
|
+
* @returns Document fragment.
|
|
437
|
+
*/
|
|
438
|
+
public createContextualFragment(tagString: string): DocumentFragment {
|
|
439
|
+
// TODO: Implement support for checking which context to use
|
|
440
|
+
return <DocumentFragment>new HTMLParser(this[PropertySymbol.window]).parse(tagString);
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* Removes the contents of the Range from the Document.
|
|
445
|
+
*
|
|
446
|
+
* @see https://dom.spec.whatwg.org/#dom-range-deletecontents
|
|
447
|
+
*/
|
|
448
|
+
public deleteContents(): void {
|
|
449
|
+
const startOffset = this.startOffset;
|
|
450
|
+
const endOffset = this.endOffset;
|
|
451
|
+
|
|
452
|
+
if (this.collapsed) {
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
if (
|
|
457
|
+
this[PropertySymbol.start].node === this[PropertySymbol.end].node &&
|
|
458
|
+
(this[PropertySymbol.start].node[PropertySymbol.nodeType] === NodeTypeEnum.textNode ||
|
|
459
|
+
this[PropertySymbol.start].node[PropertySymbol.nodeType] ===
|
|
460
|
+
NodeTypeEnum.processingInstructionNode ||
|
|
461
|
+
this[PropertySymbol.start].node[PropertySymbol.nodeType] === NodeTypeEnum.commentNode)
|
|
462
|
+
) {
|
|
463
|
+
(<Text | Comment>this[PropertySymbol.start].node).replaceData(
|
|
464
|
+
startOffset,
|
|
465
|
+
endOffset - startOffset,
|
|
466
|
+
''
|
|
467
|
+
);
|
|
468
|
+
return;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
const nodesToRemove = [];
|
|
472
|
+
let currentNode: Node | null = this[PropertySymbol.start].node;
|
|
473
|
+
const endNode = NodeUtility.nextDescendantNode(this[PropertySymbol.end].node);
|
|
474
|
+
while (currentNode && currentNode !== endNode) {
|
|
475
|
+
if (
|
|
476
|
+
RangeUtility.isContained(currentNode, this) &&
|
|
477
|
+
!RangeUtility.isContained(currentNode[PropertySymbol.parentNode]!, this)
|
|
478
|
+
) {
|
|
479
|
+
nodesToRemove.push(currentNode);
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
currentNode = NodeUtility.following(currentNode);
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
let newNode;
|
|
486
|
+
let newOffset;
|
|
487
|
+
if (
|
|
488
|
+
NodeUtility.isInclusiveAncestor(
|
|
489
|
+
this[PropertySymbol.start].node,
|
|
490
|
+
this[PropertySymbol.end].node
|
|
491
|
+
)
|
|
492
|
+
) {
|
|
493
|
+
newNode = this[PropertySymbol.start].node;
|
|
494
|
+
newOffset = startOffset;
|
|
495
|
+
} else {
|
|
496
|
+
let referenceNode = this[PropertySymbol.start].node;
|
|
497
|
+
|
|
498
|
+
while (
|
|
499
|
+
referenceNode &&
|
|
500
|
+
!NodeUtility.isInclusiveAncestor(
|
|
501
|
+
referenceNode[PropertySymbol.parentNode],
|
|
502
|
+
this[PropertySymbol.end].node
|
|
503
|
+
)
|
|
504
|
+
) {
|
|
505
|
+
referenceNode = referenceNode[PropertySymbol.parentNode]!;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
newNode = referenceNode[PropertySymbol.parentNode]!;
|
|
509
|
+
newOffset =
|
|
510
|
+
(<Node>referenceNode[PropertySymbol.parentNode])[PropertySymbol.nodeArray].indexOf(
|
|
511
|
+
referenceNode
|
|
512
|
+
) + 1;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
if (
|
|
516
|
+
this[PropertySymbol.start].node[PropertySymbol.nodeType] === NodeTypeEnum.textNode ||
|
|
517
|
+
this[PropertySymbol.start].node[PropertySymbol.nodeType] ===
|
|
518
|
+
NodeTypeEnum.processingInstructionNode ||
|
|
519
|
+
this[PropertySymbol.start].node[PropertySymbol.nodeType] === NodeTypeEnum.commentNode
|
|
520
|
+
) {
|
|
521
|
+
(<Text | Comment>this[PropertySymbol.start].node).replaceData(
|
|
522
|
+
this.startOffset,
|
|
523
|
+
NodeUtility.getNodeLength(this[PropertySymbol.start].node) - this.startOffset,
|
|
524
|
+
''
|
|
525
|
+
);
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
for (const node of nodesToRemove) {
|
|
529
|
+
const parent = node[PropertySymbol.parentNode]!;
|
|
530
|
+
parent.removeChild(node);
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
if (
|
|
534
|
+
this[PropertySymbol.end].node[PropertySymbol.nodeType] === NodeTypeEnum.textNode ||
|
|
535
|
+
this[PropertySymbol.end].node[PropertySymbol.nodeType] ===
|
|
536
|
+
NodeTypeEnum.processingInstructionNode ||
|
|
537
|
+
this[PropertySymbol.end].node[PropertySymbol.nodeType] === NodeTypeEnum.commentNode
|
|
538
|
+
) {
|
|
539
|
+
(<Text | Comment>this[PropertySymbol.end].node).replaceData(0, endOffset, '');
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
this[PropertySymbol.start].node = newNode;
|
|
543
|
+
this[PropertySymbol.start].offset = newOffset;
|
|
544
|
+
this[PropertySymbol.end].node = newNode;
|
|
545
|
+
this[PropertySymbol.end].offset = newOffset;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
/**
|
|
549
|
+
* Does nothing. It used to disable the Range object and enable the browser to release associated resources. The method has been kept for compatibility.
|
|
550
|
+
*
|
|
551
|
+
* @see https://dom.spec.whatwg.org/#dom-range-detach
|
|
552
|
+
*/
|
|
553
|
+
public detach(): void {
|
|
554
|
+
// Do nothing by spec
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
/**
|
|
558
|
+
* Moves contents of the Range from the document tree into a DocumentFragment.
|
|
559
|
+
*
|
|
560
|
+
* @see https://dom.spec.whatwg.org/#dom-range-extractcontents
|
|
561
|
+
* @returns Document fragment.
|
|
562
|
+
*/
|
|
563
|
+
public extractContents(): DocumentFragment {
|
|
564
|
+
const window = this[PropertySymbol.window];
|
|
565
|
+
const fragment = this[PropertySymbol.ownerDocument].createDocumentFragment();
|
|
566
|
+
const startOffset = this.startOffset;
|
|
567
|
+
const endOffset = this.endOffset;
|
|
568
|
+
|
|
569
|
+
if (this.collapsed) {
|
|
570
|
+
return fragment;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
if (
|
|
574
|
+
this[PropertySymbol.start].node === this[PropertySymbol.end].node &&
|
|
575
|
+
(this[PropertySymbol.start].node[PropertySymbol.nodeType] === NodeTypeEnum.textNode ||
|
|
576
|
+
this[PropertySymbol.start].node[PropertySymbol.nodeType] ===
|
|
577
|
+
NodeTypeEnum.processingInstructionNode ||
|
|
578
|
+
this[PropertySymbol.start].node[PropertySymbol.nodeType] === NodeTypeEnum.commentNode)
|
|
579
|
+
) {
|
|
580
|
+
const clone = <Text | Comment>this[PropertySymbol.start].node.cloneNode(false);
|
|
581
|
+
clone[PropertySymbol.data] = clone.substringData(startOffset, endOffset - startOffset);
|
|
582
|
+
|
|
583
|
+
fragment.appendChild(clone);
|
|
584
|
+
|
|
585
|
+
(<Text | Comment>this[PropertySymbol.start].node).replaceData(
|
|
586
|
+
startOffset,
|
|
587
|
+
endOffset - startOffset,
|
|
588
|
+
''
|
|
589
|
+
);
|
|
590
|
+
|
|
591
|
+
return fragment;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
let commonAncestor = this[PropertySymbol.start].node;
|
|
595
|
+
while (!NodeUtility.isInclusiveAncestor(commonAncestor, this[PropertySymbol.end].node)) {
|
|
596
|
+
commonAncestor = commonAncestor[PropertySymbol.parentNode]!;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
let firstPartialContainedChild = null;
|
|
600
|
+
if (
|
|
601
|
+
!NodeUtility.isInclusiveAncestor(
|
|
602
|
+
this[PropertySymbol.start].node,
|
|
603
|
+
this[PropertySymbol.end].node
|
|
604
|
+
)
|
|
605
|
+
) {
|
|
606
|
+
let candidate = commonAncestor.firstChild!;
|
|
607
|
+
while (!firstPartialContainedChild) {
|
|
608
|
+
if (RangeUtility.isPartiallyContained(candidate, this)) {
|
|
609
|
+
firstPartialContainedChild = candidate;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
candidate = candidate.nextSibling!;
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
let lastPartiallyContainedChild = null;
|
|
617
|
+
if (
|
|
618
|
+
!NodeUtility.isInclusiveAncestor(
|
|
619
|
+
this[PropertySymbol.end].node,
|
|
620
|
+
this[PropertySymbol.start].node
|
|
621
|
+
)
|
|
622
|
+
) {
|
|
623
|
+
let candidate = commonAncestor.lastChild!;
|
|
624
|
+
while (!lastPartiallyContainedChild) {
|
|
625
|
+
if (RangeUtility.isPartiallyContained(candidate, this)) {
|
|
626
|
+
lastPartiallyContainedChild = candidate;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
candidate = candidate.previousSibling!;
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
const containedChildren = [];
|
|
634
|
+
|
|
635
|
+
for (const node of (<Node>commonAncestor)[PropertySymbol.nodeArray]) {
|
|
636
|
+
if (RangeUtility.isContained(node, this)) {
|
|
637
|
+
if (node[PropertySymbol.nodeType] === NodeTypeEnum.documentTypeNode) {
|
|
638
|
+
throw new this[PropertySymbol.window].DOMException(
|
|
639
|
+
'Invalid document type element.',
|
|
640
|
+
DOMExceptionNameEnum.hierarchyRequestError
|
|
641
|
+
);
|
|
642
|
+
}
|
|
643
|
+
containedChildren.push(node);
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
let newNode;
|
|
648
|
+
let newOffset;
|
|
649
|
+
if (
|
|
650
|
+
NodeUtility.isInclusiveAncestor(
|
|
651
|
+
this[PropertySymbol.start].node,
|
|
652
|
+
this[PropertySymbol.end].node
|
|
653
|
+
)
|
|
654
|
+
) {
|
|
655
|
+
newNode = this[PropertySymbol.start].node;
|
|
656
|
+
newOffset = startOffset;
|
|
657
|
+
} else {
|
|
658
|
+
let referenceNode = this[PropertySymbol.start].node;
|
|
659
|
+
|
|
660
|
+
while (
|
|
661
|
+
referenceNode &&
|
|
662
|
+
!NodeUtility.isInclusiveAncestor(
|
|
663
|
+
referenceNode[PropertySymbol.parentNode],
|
|
664
|
+
this[PropertySymbol.end].node
|
|
665
|
+
)
|
|
666
|
+
) {
|
|
667
|
+
referenceNode = referenceNode[PropertySymbol.parentNode]!;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
newNode = referenceNode[PropertySymbol.parentNode]!;
|
|
671
|
+
newOffset =
|
|
672
|
+
(<Node>referenceNode[PropertySymbol.parentNode])[PropertySymbol.nodeArray].indexOf(
|
|
673
|
+
referenceNode
|
|
674
|
+
) + 1;
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
if (
|
|
678
|
+
firstPartialContainedChild !== null &&
|
|
679
|
+
(firstPartialContainedChild[PropertySymbol.nodeType] === NodeTypeEnum.textNode ||
|
|
680
|
+
firstPartialContainedChild[PropertySymbol.nodeType] ===
|
|
681
|
+
NodeTypeEnum.processingInstructionNode ||
|
|
682
|
+
firstPartialContainedChild[PropertySymbol.nodeType] === NodeTypeEnum.commentNode)
|
|
683
|
+
) {
|
|
684
|
+
const clone = <Text | Comment>this[PropertySymbol.start].node.cloneNode(false);
|
|
685
|
+
clone[PropertySymbol.data] = clone.substringData(
|
|
686
|
+
startOffset,
|
|
687
|
+
NodeUtility.getNodeLength(this[PropertySymbol.start].node) - startOffset
|
|
688
|
+
);
|
|
689
|
+
|
|
690
|
+
fragment.appendChild(clone);
|
|
691
|
+
|
|
692
|
+
(<Text | Comment>this[PropertySymbol.start].node).replaceData(
|
|
693
|
+
startOffset,
|
|
694
|
+
NodeUtility.getNodeLength(this[PropertySymbol.start].node) - startOffset,
|
|
695
|
+
''
|
|
696
|
+
);
|
|
697
|
+
} else if (firstPartialContainedChild !== null) {
|
|
698
|
+
const clone = firstPartialContainedChild.cloneNode(false);
|
|
699
|
+
fragment.appendChild(clone);
|
|
700
|
+
|
|
701
|
+
const subRange = new window.Range();
|
|
702
|
+
subRange[PropertySymbol.start].node = this[PropertySymbol.start].node;
|
|
703
|
+
subRange[PropertySymbol.start].offset = startOffset;
|
|
704
|
+
subRange[PropertySymbol.end].node = firstPartialContainedChild;
|
|
705
|
+
subRange[PropertySymbol.end].offset = NodeUtility.getNodeLength(firstPartialContainedChild);
|
|
706
|
+
|
|
707
|
+
const subFragment = subRange.extractContents();
|
|
708
|
+
clone.appendChild(subFragment);
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
for (const containedChild of containedChildren) {
|
|
712
|
+
fragment.appendChild(containedChild);
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
if (
|
|
716
|
+
lastPartiallyContainedChild !== null &&
|
|
717
|
+
(lastPartiallyContainedChild[PropertySymbol.nodeType] === NodeTypeEnum.textNode ||
|
|
718
|
+
lastPartiallyContainedChild[PropertySymbol.nodeType] ===
|
|
719
|
+
NodeTypeEnum.processingInstructionNode ||
|
|
720
|
+
lastPartiallyContainedChild[PropertySymbol.nodeType] === NodeTypeEnum.commentNode)
|
|
721
|
+
) {
|
|
722
|
+
const clone = <Text | Comment>this[PropertySymbol.end].node.cloneNode(false);
|
|
723
|
+
clone[PropertySymbol.data] = clone.substringData(0, endOffset);
|
|
724
|
+
|
|
725
|
+
fragment.appendChild(clone);
|
|
726
|
+
|
|
727
|
+
(<Text | Comment>this[PropertySymbol.end].node).replaceData(0, endOffset, '');
|
|
728
|
+
} else if (lastPartiallyContainedChild !== null) {
|
|
729
|
+
const clone = lastPartiallyContainedChild.cloneNode(false);
|
|
730
|
+
fragment.appendChild(clone);
|
|
731
|
+
|
|
732
|
+
const subRange = new window.Range();
|
|
733
|
+
subRange[PropertySymbol.start].node = lastPartiallyContainedChild;
|
|
734
|
+
subRange[PropertySymbol.start].offset = 0;
|
|
735
|
+
subRange[PropertySymbol.end].node = this[PropertySymbol.end].node;
|
|
736
|
+
subRange[PropertySymbol.end].offset = endOffset;
|
|
737
|
+
|
|
738
|
+
const subFragment = subRange.extractContents();
|
|
739
|
+
clone.appendChild(subFragment);
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
this[PropertySymbol.start].node = newNode;
|
|
743
|
+
this[PropertySymbol.start].offset = newOffset;
|
|
744
|
+
this[PropertySymbol.end].node = newNode;
|
|
745
|
+
this[PropertySymbol.end].offset = newOffset;
|
|
746
|
+
|
|
747
|
+
return fragment;
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
/**
|
|
751
|
+
* Returns a DOMRect object that bounds the contents of the range; this is a rectangle enclosing the union of the bounding rectangles for all the elements in the range.
|
|
752
|
+
*
|
|
753
|
+
* @returns DOMRect object.
|
|
754
|
+
*/
|
|
755
|
+
public getBoundingClientRect(): DOMRect {
|
|
756
|
+
// TODO: Not full implementation
|
|
757
|
+
return new DOMRect();
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
/**
|
|
761
|
+
* The Range.getClientRects() method returns a list of DOMRect objects representing the area of the screen occupied by the range. This is created by aggregating the results of calls to Element.getClientRects() for all the elements in the range.
|
|
762
|
+
*
|
|
763
|
+
* @returns DOMRect objects.
|
|
764
|
+
*/
|
|
765
|
+
public getClientRects(): DOMRectList {
|
|
766
|
+
// TODO: Not full implementation
|
|
767
|
+
return new DOMRectList(PropertySymbol.illegalConstructor);
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
/**
|
|
771
|
+
* Returns a boolean indicating whether the given point is in the Range.
|
|
772
|
+
*
|
|
773
|
+
* @see https://dom.spec.whatwg.org/#dom-range-ispointinrange
|
|
774
|
+
* @param node Reference node.
|
|
775
|
+
* @param offset Offset.
|
|
776
|
+
* @returns "true" if in range.
|
|
777
|
+
*/
|
|
778
|
+
public isPointInRange(node: Node, offset = 0): boolean {
|
|
779
|
+
if (node[PropertySymbol.ownerDocument] !== this[PropertySymbol.ownerDocument]) {
|
|
780
|
+
return false;
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
const boundaryPoint = { node, offset };
|
|
784
|
+
|
|
785
|
+
RangeUtility.validateBoundaryPoint(boundaryPoint);
|
|
786
|
+
|
|
787
|
+
if (
|
|
788
|
+
RangeUtility.compareBoundaryPointsPosition(boundaryPoint, {
|
|
789
|
+
node: this[PropertySymbol.start].node,
|
|
790
|
+
offset: this.startOffset
|
|
791
|
+
}) === -1 ||
|
|
792
|
+
RangeUtility.compareBoundaryPointsPosition(boundaryPoint, {
|
|
793
|
+
node: this[PropertySymbol.end].node,
|
|
794
|
+
offset: this.endOffset
|
|
795
|
+
}) === 1
|
|
796
|
+
) {
|
|
797
|
+
return false;
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
return true;
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
/**
|
|
804
|
+
* Inserts a node at the start of the Range.
|
|
805
|
+
*
|
|
806
|
+
* @see https://dom.spec.whatwg.org/#concept-range-insert
|
|
807
|
+
* @param newNode New node.
|
|
808
|
+
*/
|
|
809
|
+
public insertNode(newNode: Node): void {
|
|
810
|
+
if (
|
|
811
|
+
this[PropertySymbol.start].node[PropertySymbol.nodeType] ===
|
|
812
|
+
NodeTypeEnum.processingInstructionNode ||
|
|
813
|
+
this[PropertySymbol.start].node[PropertySymbol.nodeType] === NodeTypeEnum.commentNode ||
|
|
814
|
+
(this[PropertySymbol.start].node[PropertySymbol.nodeType] === NodeTypeEnum.textNode &&
|
|
815
|
+
!this[PropertySymbol.start].node[PropertySymbol.parentNode]) ||
|
|
816
|
+
newNode === this[PropertySymbol.start].node
|
|
817
|
+
) {
|
|
818
|
+
throw new this[PropertySymbol.window].DOMException(
|
|
819
|
+
'Invalid start node.',
|
|
820
|
+
DOMExceptionNameEnum.hierarchyRequestError
|
|
821
|
+
);
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
let referenceNode =
|
|
825
|
+
this[PropertySymbol.start].node[PropertySymbol.nodeType] === NodeTypeEnum.textNode
|
|
826
|
+
? this[PropertySymbol.start].node
|
|
827
|
+
: (<Node>this[PropertySymbol.start].node)[PropertySymbol.nodeArray][this.startOffset] ||
|
|
828
|
+
null;
|
|
829
|
+
const parent = !referenceNode
|
|
830
|
+
? this[PropertySymbol.start].node
|
|
831
|
+
: referenceNode[PropertySymbol.parentNode]!;
|
|
832
|
+
|
|
833
|
+
if (this[PropertySymbol.start].node[PropertySymbol.nodeType] === NodeTypeEnum.textNode) {
|
|
834
|
+
referenceNode = (<Text>this[PropertySymbol.start].node).splitText(this.startOffset);
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
if (newNode === referenceNode) {
|
|
838
|
+
referenceNode = referenceNode.nextSibling!;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
const nodeParent = newNode[PropertySymbol.parentNode];
|
|
842
|
+
if (nodeParent) {
|
|
843
|
+
nodeParent.removeChild(newNode);
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
let newOffset = !referenceNode
|
|
847
|
+
? NodeUtility.getNodeLength(parent)
|
|
848
|
+
: (<Node>referenceNode[PropertySymbol.parentNode])[PropertySymbol.nodeArray].indexOf(
|
|
849
|
+
referenceNode
|
|
850
|
+
);
|
|
851
|
+
newOffset +=
|
|
852
|
+
newNode[PropertySymbol.nodeType] === NodeTypeEnum.documentFragmentNode
|
|
853
|
+
? NodeUtility.getNodeLength(newNode)
|
|
854
|
+
: 1;
|
|
855
|
+
|
|
856
|
+
parent.insertBefore(newNode, referenceNode);
|
|
857
|
+
|
|
858
|
+
if (this.collapsed) {
|
|
859
|
+
this[PropertySymbol.end].node = parent;
|
|
860
|
+
this[PropertySymbol.end].offset = newOffset;
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
/**
|
|
865
|
+
* Returns a boolean indicating whether the given Node intersects the Range.
|
|
866
|
+
*
|
|
867
|
+
* @see https://dom.spec.whatwg.org/#dom-range-intersectsnode
|
|
868
|
+
* @param node Reference node.
|
|
869
|
+
* @returns "true" if it intersects.
|
|
870
|
+
*/
|
|
871
|
+
public intersectsNode(node: Node): boolean {
|
|
872
|
+
if (node[PropertySymbol.ownerDocument] !== this[PropertySymbol.ownerDocument]) {
|
|
873
|
+
return false;
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
const parent = node[PropertySymbol.parentNode];
|
|
877
|
+
|
|
878
|
+
if (!parent) {
|
|
879
|
+
return true;
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
const offset = (<Node>parent)[PropertySymbol.nodeArray].indexOf(node);
|
|
883
|
+
|
|
884
|
+
return (
|
|
885
|
+
RangeUtility.compareBoundaryPointsPosition(
|
|
886
|
+
{ node: parent, offset },
|
|
887
|
+
{ node: this[PropertySymbol.end].node, offset: this.endOffset }
|
|
888
|
+
) === -1 &&
|
|
889
|
+
RangeUtility.compareBoundaryPointsPosition(
|
|
890
|
+
{ node: parent, offset: offset + 1 },
|
|
891
|
+
{ node: this[PropertySymbol.start].node, offset: this.startOffset }
|
|
892
|
+
) === 1
|
|
893
|
+
);
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
/**
|
|
897
|
+
* Sets the Range to contain the Node and its contents.
|
|
898
|
+
*
|
|
899
|
+
* @see https://dom.spec.whatwg.org/#concept-range-select
|
|
900
|
+
* @param node Reference node.
|
|
901
|
+
*/
|
|
902
|
+
public selectNode(node: Node): void {
|
|
903
|
+
if (!node[PropertySymbol.parentNode]) {
|
|
904
|
+
throw new this[PropertySymbol.window].DOMException(
|
|
905
|
+
`The given Node has no parent.`,
|
|
906
|
+
DOMExceptionNameEnum.invalidNodeTypeError
|
|
907
|
+
);
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
const index = (<Node>node[PropertySymbol.parentNode])[PropertySymbol.nodeArray].indexOf(node);
|
|
911
|
+
|
|
912
|
+
this[PropertySymbol.start].node = node[PropertySymbol.parentNode];
|
|
913
|
+
this[PropertySymbol.start].offset = index;
|
|
914
|
+
this[PropertySymbol.end].node = node[PropertySymbol.parentNode];
|
|
915
|
+
this[PropertySymbol.end].offset = index + 1;
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
/**
|
|
919
|
+
* Sets the Range to contain the contents of a Node.
|
|
920
|
+
*
|
|
921
|
+
* @see https://dom.spec.whatwg.org/#dom-range-selectnodecontents
|
|
922
|
+
* @param node Reference node.
|
|
923
|
+
*/
|
|
924
|
+
public selectNodeContents(node: Node): void {
|
|
925
|
+
if (node[PropertySymbol.nodeType] === NodeTypeEnum.documentTypeNode) {
|
|
926
|
+
throw new this[PropertySymbol.window].DOMException(
|
|
927
|
+
"DocumentType Node can't be used as boundary point.",
|
|
928
|
+
DOMExceptionNameEnum.invalidNodeTypeError
|
|
929
|
+
);
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
this[PropertySymbol.start].node = node;
|
|
933
|
+
this[PropertySymbol.start].offset = 0;
|
|
934
|
+
this[PropertySymbol.end].node = node;
|
|
935
|
+
this[PropertySymbol.end].offset = NodeUtility.getNodeLength(node);
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
/**
|
|
939
|
+
* Sets the end position of a Range to be located at the given offset into the specified node x.
|
|
940
|
+
*
|
|
941
|
+
* @see https://dom.spec.whatwg.org/#dom-range-setend
|
|
942
|
+
* @param node End node.
|
|
943
|
+
* @param offset End offset.
|
|
944
|
+
*/
|
|
945
|
+
public setEnd(node: Node, offset = 0): void {
|
|
946
|
+
RangeUtility.validateBoundaryPoint({ node, offset });
|
|
947
|
+
|
|
948
|
+
const boundaryPoint = { node, offset };
|
|
949
|
+
|
|
950
|
+
if (
|
|
951
|
+
node[PropertySymbol.ownerDocument] !== this[PropertySymbol.ownerDocument] ||
|
|
952
|
+
RangeUtility.compareBoundaryPointsPosition(boundaryPoint, {
|
|
953
|
+
node: this[PropertySymbol.start].node,
|
|
954
|
+
offset: this.startOffset
|
|
955
|
+
}) === -1
|
|
956
|
+
) {
|
|
957
|
+
this[PropertySymbol.start].node = node;
|
|
958
|
+
this[PropertySymbol.start].offset = offset;
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
this[PropertySymbol.end].node = node;
|
|
962
|
+
this[PropertySymbol.end].offset = offset;
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
/**
|
|
966
|
+
* Sets the start position of a Range.
|
|
967
|
+
*
|
|
968
|
+
* @see https://dom.spec.whatwg.org/#dom-range-setstart
|
|
969
|
+
* @param node Start node.
|
|
970
|
+
* @param offset Start offset.
|
|
971
|
+
*/
|
|
972
|
+
public setStart(node: Node, offset = 0): void {
|
|
973
|
+
RangeUtility.validateBoundaryPoint({ node, offset });
|
|
974
|
+
|
|
975
|
+
const boundaryPoint = { node, offset };
|
|
976
|
+
|
|
977
|
+
if (
|
|
978
|
+
node[PropertySymbol.ownerDocument] !== this[PropertySymbol.ownerDocument] ||
|
|
979
|
+
RangeUtility.compareBoundaryPointsPosition(boundaryPoint, {
|
|
980
|
+
node: this[PropertySymbol.end].node,
|
|
981
|
+
offset: this.endOffset
|
|
982
|
+
}) === 1
|
|
983
|
+
) {
|
|
984
|
+
this[PropertySymbol.end].node = node;
|
|
985
|
+
this[PropertySymbol.end].offset = offset;
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
this[PropertySymbol.start].node = node;
|
|
989
|
+
this[PropertySymbol.start].offset = offset;
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
/**
|
|
993
|
+
* Sets the end position of a Range relative to another Node.
|
|
994
|
+
*
|
|
995
|
+
* @see https://dom.spec.whatwg.org/#dom-range-setendafter
|
|
996
|
+
* @param node Reference node.
|
|
997
|
+
*/
|
|
998
|
+
public setEndAfter(node: Node): void {
|
|
999
|
+
if (!node[PropertySymbol.parentNode]) {
|
|
1000
|
+
throw new this[PropertySymbol.window].DOMException(
|
|
1001
|
+
'The given Node has no parent.',
|
|
1002
|
+
DOMExceptionNameEnum.invalidNodeTypeError
|
|
1003
|
+
);
|
|
1004
|
+
}
|
|
1005
|
+
this.setEnd(
|
|
1006
|
+
node[PropertySymbol.parentNode],
|
|
1007
|
+
(<Node>node[PropertySymbol.parentNode])[PropertySymbol.nodeArray].indexOf(node) + 1
|
|
1008
|
+
);
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
/**
|
|
1012
|
+
* Sets the end position of a Range relative to another Node.
|
|
1013
|
+
*
|
|
1014
|
+
* @see https://dom.spec.whatwg.org/#dom-range-setendbefore
|
|
1015
|
+
* @param node Reference node.
|
|
1016
|
+
*/
|
|
1017
|
+
public setEndBefore(node: Node): void {
|
|
1018
|
+
if (!node[PropertySymbol.parentNode]) {
|
|
1019
|
+
throw new this[PropertySymbol.window].DOMException(
|
|
1020
|
+
'The given Node has no parent.',
|
|
1021
|
+
DOMExceptionNameEnum.invalidNodeTypeError
|
|
1022
|
+
);
|
|
1023
|
+
}
|
|
1024
|
+
this.setEnd(
|
|
1025
|
+
node[PropertySymbol.parentNode],
|
|
1026
|
+
(<Node>node[PropertySymbol.parentNode])[PropertySymbol.nodeArray].indexOf(node)
|
|
1027
|
+
);
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
/**
|
|
1031
|
+
* Sets the start position of a Range relative to a Node.
|
|
1032
|
+
*
|
|
1033
|
+
* @see https://dom.spec.whatwg.org/#dom-range-setstartafter
|
|
1034
|
+
* @param node Reference node.
|
|
1035
|
+
*/
|
|
1036
|
+
public setStartAfter(node: Node): void {
|
|
1037
|
+
if (!node[PropertySymbol.parentNode]) {
|
|
1038
|
+
throw new this[PropertySymbol.window].DOMException(
|
|
1039
|
+
'The given Node has no parent.',
|
|
1040
|
+
DOMExceptionNameEnum.invalidNodeTypeError
|
|
1041
|
+
);
|
|
1042
|
+
}
|
|
1043
|
+
this.setStart(
|
|
1044
|
+
node[PropertySymbol.parentNode],
|
|
1045
|
+
(<Node>node[PropertySymbol.parentNode])[PropertySymbol.nodeArray].indexOf(node) + 1
|
|
1046
|
+
);
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
/**
|
|
1050
|
+
* Sets the start position of a Range relative to another Node.
|
|
1051
|
+
*
|
|
1052
|
+
* @see https://dom.spec.whatwg.org/#dom-range-setstartbefore
|
|
1053
|
+
* @param node Reference node.
|
|
1054
|
+
*/
|
|
1055
|
+
public setStartBefore(node: Node): void {
|
|
1056
|
+
if (!node[PropertySymbol.parentNode]) {
|
|
1057
|
+
throw new this[PropertySymbol.window].DOMException(
|
|
1058
|
+
'The given Node has no parent.',
|
|
1059
|
+
DOMExceptionNameEnum.invalidNodeTypeError
|
|
1060
|
+
);
|
|
1061
|
+
}
|
|
1062
|
+
this.setStart(
|
|
1063
|
+
node[PropertySymbol.parentNode],
|
|
1064
|
+
(<Node>node[PropertySymbol.parentNode])[PropertySymbol.nodeArray].indexOf(node)
|
|
1065
|
+
);
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
/**
|
|
1069
|
+
* Moves content of the Range into a new node, placing the new node at the start of the specified range.
|
|
1070
|
+
*
|
|
1071
|
+
* @see https://dom.spec.whatwg.org/#dom-range-surroundcontents
|
|
1072
|
+
* @param newParent New parent.
|
|
1073
|
+
*/
|
|
1074
|
+
public surroundContents(newParent: Node): void {
|
|
1075
|
+
let node = this.commonAncestorContainer;
|
|
1076
|
+
|
|
1077
|
+
if (!node) {
|
|
1078
|
+
return;
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
const endNode = NodeUtility.nextDescendantNode(node);
|
|
1082
|
+
while (node && node !== endNode) {
|
|
1083
|
+
if (
|
|
1084
|
+
node[PropertySymbol.nodeType] !== NodeTypeEnum.textNode &&
|
|
1085
|
+
RangeUtility.isPartiallyContained(node, this)
|
|
1086
|
+
) {
|
|
1087
|
+
throw new this[PropertySymbol.window].DOMException(
|
|
1088
|
+
'The Range has partially contains a non-Text node.',
|
|
1089
|
+
DOMExceptionNameEnum.invalidStateError
|
|
1090
|
+
);
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
node = NodeUtility.following(node);
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
if (
|
|
1097
|
+
newParent[PropertySymbol.nodeType] === NodeTypeEnum.documentNode ||
|
|
1098
|
+
newParent[PropertySymbol.nodeType] === NodeTypeEnum.documentTypeNode ||
|
|
1099
|
+
newParent[PropertySymbol.nodeType] === NodeTypeEnum.documentFragmentNode
|
|
1100
|
+
) {
|
|
1101
|
+
throw new this[PropertySymbol.window].DOMException(
|
|
1102
|
+
'Invalid element type.',
|
|
1103
|
+
DOMExceptionNameEnum.invalidNodeTypeError
|
|
1104
|
+
);
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
const fragment = this.extractContents();
|
|
1108
|
+
|
|
1109
|
+
while (newParent.firstChild) {
|
|
1110
|
+
newParent.removeChild(newParent.firstChild);
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1113
|
+
this.insertNode(newParent);
|
|
1114
|
+
|
|
1115
|
+
newParent.appendChild(fragment);
|
|
1116
|
+
|
|
1117
|
+
this.selectNode(newParent);
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
/**
|
|
1121
|
+
* Returns the text of the Range.
|
|
1122
|
+
*
|
|
1123
|
+
* @see https://dom.spec.whatwg.org/#dom-range-stringifier
|
|
1124
|
+
*/
|
|
1125
|
+
public toString(): string {
|
|
1126
|
+
const startOffset = this.startOffset;
|
|
1127
|
+
const endOffset = this.endOffset;
|
|
1128
|
+
let string = '';
|
|
1129
|
+
|
|
1130
|
+
if (
|
|
1131
|
+
this[PropertySymbol.start].node === this[PropertySymbol.end].node &&
|
|
1132
|
+
this[PropertySymbol.start].node[PropertySymbol.nodeType] === NodeTypeEnum.textNode
|
|
1133
|
+
) {
|
|
1134
|
+
return (<Text>this[PropertySymbol.start].node).data.slice(startOffset, endOffset);
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
if (this[PropertySymbol.start].node[PropertySymbol.nodeType] === NodeTypeEnum.textNode) {
|
|
1138
|
+
string += (<Text>this[PropertySymbol.start].node).data.slice(startOffset);
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
const endNode = NodeUtility.nextDescendantNode(this[PropertySymbol.end].node);
|
|
1142
|
+
let currentNode: Node | null = this[PropertySymbol.start].node;
|
|
1143
|
+
|
|
1144
|
+
while (currentNode && currentNode !== endNode) {
|
|
1145
|
+
if (
|
|
1146
|
+
currentNode[PropertySymbol.nodeType] === NodeTypeEnum.textNode &&
|
|
1147
|
+
RangeUtility.isContained(currentNode, this)
|
|
1148
|
+
) {
|
|
1149
|
+
string += (<Text>currentNode).data;
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1152
|
+
currentNode = NodeUtility.following(currentNode);
|
|
1153
|
+
}
|
|
1154
|
+
|
|
1155
|
+
if (this[PropertySymbol.end].node[PropertySymbol.nodeType] === NodeTypeEnum.textNode) {
|
|
1156
|
+
string += (<Text>this[PropertySymbol.end].node).data.slice(0, endOffset);
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
return string;
|
|
1160
|
+
}
|
|
1161
|
+
}
|