@depup/jsdom 28.1.0-depup.1
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/LICENSE.txt +22 -0
- package/README.md +38 -0
- package/changes.json +38 -0
- package/lib/api.js +373 -0
- package/lib/generated/event-sets.js +115 -0
- package/lib/generated/idl/AbortController.js +143 -0
- package/lib/generated/idl/AbortSignal.js +249 -0
- package/lib/generated/idl/AbstractRange.js +171 -0
- package/lib/generated/idl/AddEventListenerOptions.js +53 -0
- package/lib/generated/idl/AssignedNodesOptions.js +28 -0
- package/lib/generated/idl/Attr.js +219 -0
- package/lib/generated/idl/BarProp.js +117 -0
- package/lib/generated/idl/BeforeUnloadEvent.js +139 -0
- package/lib/generated/idl/BinaryType.js +12 -0
- package/lib/generated/idl/Blob.js +253 -0
- package/lib/generated/idl/BlobCallback.js +30 -0
- package/lib/generated/idl/BlobEvent.js +157 -0
- package/lib/generated/idl/BlobEventInit.js +43 -0
- package/lib/generated/idl/BlobPropertyBag.js +42 -0
- package/lib/generated/idl/CDATASection.js +109 -0
- package/lib/generated/idl/CanPlayTypeResult.js +12 -0
- package/lib/generated/idl/CharacterData.js +455 -0
- package/lib/generated/idl/CloseEvent.js +168 -0
- package/lib/generated/idl/CloseEventInit.js +65 -0
- package/lib/generated/idl/Comment.js +120 -0
- package/lib/generated/idl/CompositionEvent.js +219 -0
- package/lib/generated/idl/CompositionEventInit.js +32 -0
- package/lib/generated/idl/Crypto.js +148 -0
- package/lib/generated/idl/CustomElementConstructor.js +34 -0
- package/lib/generated/idl/CustomElementRegistry.js +269 -0
- package/lib/generated/idl/CustomEvent.js +206 -0
- package/lib/generated/idl/CustomEventInit.js +32 -0
- package/lib/generated/idl/DOMException.js +222 -0
- package/lib/generated/idl/DOMImplementation.js +237 -0
- package/lib/generated/idl/DOMParser.js +140 -0
- package/lib/generated/idl/DOMRect.js +276 -0
- package/lib/generated/idl/DOMRectInit.js +76 -0
- package/lib/generated/idl/DOMRectReadOnly.js +285 -0
- package/lib/generated/idl/DOMStringMap.js +299 -0
- package/lib/generated/idl/DOMTokenList.js +539 -0
- package/lib/generated/idl/DeviceMotionEvent.js +183 -0
- package/lib/generated/idl/DeviceMotionEventAcceleration.js +145 -0
- package/lib/generated/idl/DeviceMotionEventAccelerationInit.js +61 -0
- package/lib/generated/idl/DeviceMotionEventInit.js +70 -0
- package/lib/generated/idl/DeviceMotionEventRotationRate.js +145 -0
- package/lib/generated/idl/DeviceMotionEventRotationRateInit.js +61 -0
- package/lib/generated/idl/DeviceOrientationEvent.js +183 -0
- package/lib/generated/idl/DeviceOrientationEventInit.js +80 -0
- package/lib/generated/idl/Document.js +4511 -0
- package/lib/generated/idl/DocumentFragment.js +336 -0
- package/lib/generated/idl/DocumentReadyState.js +12 -0
- package/lib/generated/idl/DocumentType.js +254 -0
- package/lib/generated/idl/Element.js +3720 -0
- package/lib/generated/idl/ElementCreationOptions.js +26 -0
- package/lib/generated/idl/ElementDefinitionOptions.js +29 -0
- package/lib/generated/idl/ElementInternals.js +2152 -0
- package/lib/generated/idl/EndingType.js +12 -0
- package/lib/generated/idl/ErrorEvent.js +192 -0
- package/lib/generated/idl/ErrorEventInit.js +92 -0
- package/lib/generated/idl/Event.js +430 -0
- package/lib/generated/idl/EventHandlerNonNull.js +36 -0
- package/lib/generated/idl/EventInit.js +58 -0
- package/lib/generated/idl/EventListener.js +35 -0
- package/lib/generated/idl/EventListenerOptions.js +28 -0
- package/lib/generated/idl/EventModifierInit.js +221 -0
- package/lib/generated/idl/EventTarget.js +259 -0
- package/lib/generated/idl/External.js +130 -0
- package/lib/generated/idl/File.js +185 -0
- package/lib/generated/idl/FileList.js +298 -0
- package/lib/generated/idl/FilePropertyBag.js +33 -0
- package/lib/generated/idl/FileReader.js +468 -0
- package/lib/generated/idl/FocusEvent.js +144 -0
- package/lib/generated/idl/FocusEventInit.js +36 -0
- package/lib/generated/idl/FormData.js +468 -0
- package/lib/generated/idl/Function.js +42 -0
- package/lib/generated/idl/GetRootNodeOptions.js +31 -0
- package/lib/generated/idl/HTMLAnchorElement.js +1026 -0
- package/lib/generated/idl/HTMLAreaElement.js +825 -0
- package/lib/generated/idl/HTMLAudioElement.js +111 -0
- package/lib/generated/idl/HTMLBRElement.js +156 -0
- package/lib/generated/idl/HTMLBaseElement.js +196 -0
- package/lib/generated/idl/HTMLBodyElement.js +880 -0
- package/lib/generated/idl/HTMLButtonElement.js +525 -0
- package/lib/generated/idl/HTMLCanvasElement.js +307 -0
- package/lib/generated/idl/HTMLCollection.js +352 -0
- package/lib/generated/idl/HTMLDListElement.js +159 -0
- package/lib/generated/idl/HTMLDataElement.js +156 -0
- package/lib/generated/idl/HTMLDataListElement.js +126 -0
- package/lib/generated/idl/HTMLDetailsElement.js +159 -0
- package/lib/generated/idl/HTMLDialogElement.js +159 -0
- package/lib/generated/idl/HTMLDirectoryElement.js +159 -0
- package/lib/generated/idl/HTMLDivElement.js +156 -0
- package/lib/generated/idl/HTMLElement.js +3492 -0
- package/lib/generated/idl/HTMLEmbedElement.js +381 -0
- package/lib/generated/idl/HTMLFieldSetElement.js +332 -0
- package/lib/generated/idl/HTMLFontElement.js +239 -0
- package/lib/generated/idl/HTMLFormControlsCollection.js +318 -0
- package/lib/generated/idl/HTMLFormElement.js +661 -0
- package/lib/generated/idl/HTMLFrameElement.js +513 -0
- package/lib/generated/idl/HTMLFrameSetElement.js +711 -0
- package/lib/generated/idl/HTMLHRElement.js +323 -0
- package/lib/generated/idl/HTMLHeadElement.js +111 -0
- package/lib/generated/idl/HTMLHeadingElement.js +156 -0
- package/lib/generated/idl/HTMLHtmlElement.js +156 -0
- package/lib/generated/idl/HTMLIFrameElement.js +689 -0
- package/lib/generated/idl/HTMLImageElement.js +906 -0
- package/lib/generated/idl/HTMLInputElement.js +1931 -0
- package/lib/generated/idl/HTMLLIElement.js +204 -0
- package/lib/generated/idl/HTMLLabelElement.js +182 -0
- package/lib/generated/idl/HTMLLegendElement.js +169 -0
- package/lib/generated/idl/HTMLLinkElement.js +555 -0
- package/lib/generated/idl/HTMLMapElement.js +171 -0
- package/lib/generated/idl/HTMLMarqueeElement.js +558 -0
- package/lib/generated/idl/HTMLMediaElement.js +900 -0
- package/lib/generated/idl/HTMLMenuElement.js +159 -0
- package/lib/generated/idl/HTMLMetaElement.js +279 -0
- package/lib/generated/idl/HTMLMeterElement.js +368 -0
- package/lib/generated/idl/HTMLModElement.js +217 -0
- package/lib/generated/idl/HTMLOListElement.js +284 -0
- package/lib/generated/idl/HTMLObjectElement.js +945 -0
- package/lib/generated/idl/HTMLOptGroupElement.js +200 -0
- package/lib/generated/idl/HTMLOptionElement.js +379 -0
- package/lib/generated/idl/HTMLOptionsCollection.js +513 -0
- package/lib/generated/idl/HTMLOutputElement.js +395 -0
- package/lib/generated/idl/HTMLParagraphElement.js +156 -0
- package/lib/generated/idl/HTMLParamElement.js +279 -0
- package/lib/generated/idl/HTMLPictureElement.js +111 -0
- package/lib/generated/idl/HTMLPreElement.js +163 -0
- package/lib/generated/idl/HTMLProgressElement.js +232 -0
- package/lib/generated/idl/HTMLQuoteElement.js +176 -0
- package/lib/generated/idl/HTMLScriptElement.js +472 -0
- package/lib/generated/idl/HTMLSelectElement.js +993 -0
- package/lib/generated/idl/HTMLSlotElement.js +195 -0
- package/lib/generated/idl/HTMLSourceElement.js +340 -0
- package/lib/generated/idl/HTMLSpanElement.js +111 -0
- package/lib/generated/idl/HTMLStyleElement.js +210 -0
- package/lib/generated/idl/HTMLTableCaptionElement.js +156 -0
- package/lib/generated/idl/HTMLTableCellElement.js +733 -0
- package/lib/generated/idl/HTMLTableColElement.js +376 -0
- package/lib/generated/idl/HTMLTableElement.js +802 -0
- package/lib/generated/idl/HTMLTableRowElement.js +417 -0
- package/lib/generated/idl/HTMLTableSectionElement.js +349 -0
- package/lib/generated/idl/HTMLTemplateElement.js +124 -0
- package/lib/generated/idl/HTMLTextAreaElement.js +1210 -0
- package/lib/generated/idl/HTMLTimeElement.js +156 -0
- package/lib/generated/idl/HTMLTitleElement.js +155 -0
- package/lib/generated/idl/HTMLTrackElement.js +366 -0
- package/lib/generated/idl/HTMLUListElement.js +200 -0
- package/lib/generated/idl/HTMLUnknownElement.js +109 -0
- package/lib/generated/idl/HTMLVideoElement.js +344 -0
- package/lib/generated/idl/HashChangeEvent.js +157 -0
- package/lib/generated/idl/HashChangeEventInit.js +50 -0
- package/lib/generated/idl/Headers.js +418 -0
- package/lib/generated/idl/History.js +266 -0
- package/lib/generated/idl/InputEvent.js +168 -0
- package/lib/generated/idl/InputEventInit.js +68 -0
- package/lib/generated/idl/KeyboardEvent.js +445 -0
- package/lib/generated/idl/KeyboardEventInit.js +116 -0
- package/lib/generated/idl/Location.js +404 -0
- package/lib/generated/idl/MessageEvent.js +317 -0
- package/lib/generated/idl/MessageEventInit.js +100 -0
- package/lib/generated/idl/MimeType.js +156 -0
- package/lib/generated/idl/MimeTypeArray.js +326 -0
- package/lib/generated/idl/MouseEvent.js +595 -0
- package/lib/generated/idl/MouseEventInit.js +189 -0
- package/lib/generated/idl/MutationCallback.js +34 -0
- package/lib/generated/idl/MutationObserver.js +178 -0
- package/lib/generated/idl/MutationObserverInit.js +121 -0
- package/lib/generated/idl/MutationRecord.js +229 -0
- package/lib/generated/idl/NamedNodeMap.js +529 -0
- package/lib/generated/idl/Navigator.js +326 -0
- package/lib/generated/idl/Node.js +765 -0
- package/lib/generated/idl/NodeFilter.js +75 -0
- package/lib/generated/idl/NodeIterator.js +207 -0
- package/lib/generated/idl/NodeList.js +302 -0
- package/lib/generated/idl/OnBeforeUnloadEventHandlerNonNull.js +42 -0
- package/lib/generated/idl/OnErrorEventHandlerNonNull.js +56 -0
- package/lib/generated/idl/PageTransitionEvent.js +144 -0
- package/lib/generated/idl/PageTransitionEventInit.js +35 -0
- package/lib/generated/idl/Performance.js +142 -0
- package/lib/generated/idl/Plugin.js +359 -0
- package/lib/generated/idl/PluginArray.js +336 -0
- package/lib/generated/idl/PointerEvent.js +324 -0
- package/lib/generated/idl/PointerEventInit.js +241 -0
- package/lib/generated/idl/PopStateEvent.js +144 -0
- package/lib/generated/idl/PopStateEventInit.js +32 -0
- package/lib/generated/idl/ProcessingInstruction.js +122 -0
- package/lib/generated/idl/ProgressEvent.js +170 -0
- package/lib/generated/idl/ProgressEventInit.js +65 -0
- package/lib/generated/idl/PromiseRejectionEvent.js +157 -0
- package/lib/generated/idl/PromiseRejectionEventInit.js +42 -0
- package/lib/generated/idl/RadioNodeList.js +296 -0
- package/lib/generated/idl/Range.js +643 -0
- package/lib/generated/idl/SVGAnimatedPreserveAspectRatio.js +136 -0
- package/lib/generated/idl/SVGAnimatedRect.js +136 -0
- package/lib/generated/idl/SVGAnimatedString.js +149 -0
- package/lib/generated/idl/SVGBoundingBoxOptions.js +64 -0
- package/lib/generated/idl/SVGDefsElement.js +109 -0
- package/lib/generated/idl/SVGDescElement.js +109 -0
- package/lib/generated/idl/SVGElement.js +3157 -0
- package/lib/generated/idl/SVGGElement.js +109 -0
- package/lib/generated/idl/SVGGraphicsElement.js +139 -0
- package/lib/generated/idl/SVGMetadataElement.js +109 -0
- package/lib/generated/idl/SVGNumber.js +132 -0
- package/lib/generated/idl/SVGPreserveAspectRatio.js +196 -0
- package/lib/generated/idl/SVGRect.js +210 -0
- package/lib/generated/idl/SVGSVGElement.js +786 -0
- package/lib/generated/idl/SVGStringList.js +511 -0
- package/lib/generated/idl/SVGSwitchElement.js +109 -0
- package/lib/generated/idl/SVGSymbolElement.js +146 -0
- package/lib/generated/idl/SVGTitleElement.js +109 -0
- package/lib/generated/idl/Screen.js +180 -0
- package/lib/generated/idl/ScrollBehavior.js +12 -0
- package/lib/generated/idl/ScrollIntoViewOptions.js +45 -0
- package/lib/generated/idl/ScrollLogicalPosition.js +14 -0
- package/lib/generated/idl/ScrollOptions.js +30 -0
- package/lib/generated/idl/ScrollRestoration.js +12 -0
- package/lib/generated/idl/Selection.js +571 -0
- package/lib/generated/idl/SelectionMode.js +12 -0
- package/lib/generated/idl/ShadowRoot.js +189 -0
- package/lib/generated/idl/ShadowRootInit.js +30 -0
- package/lib/generated/idl/ShadowRootMode.js +12 -0
- package/lib/generated/idl/StaticRange.js +123 -0
- package/lib/generated/idl/StaticRangeInit.js +72 -0
- package/lib/generated/idl/Storage.js +397 -0
- package/lib/generated/idl/StorageEvent.js +318 -0
- package/lib/generated/idl/StorageEventInit.js +99 -0
- package/lib/generated/idl/StyleSheetList.js +300 -0
- package/lib/generated/idl/SubmitEvent.js +144 -0
- package/lib/generated/idl/SubmitEventInit.js +36 -0
- package/lib/generated/idl/SupportedType.js +18 -0
- package/lib/generated/idl/Text.js +170 -0
- package/lib/generated/idl/TextDecodeOptions.js +28 -0
- package/lib/generated/idl/TextDecoder.js +211 -0
- package/lib/generated/idl/TextDecoderOptions.js +43 -0
- package/lib/generated/idl/TextEncoder.js +176 -0
- package/lib/generated/idl/TextEncoderEncodeIntoResult.js +42 -0
- package/lib/generated/idl/TextTrackKind.js +12 -0
- package/lib/generated/idl/TouchEvent.js +222 -0
- package/lib/generated/idl/TouchEventInit.js +89 -0
- package/lib/generated/idl/TransitionEvent.js +170 -0
- package/lib/generated/idl/TransitionEventInit.js +65 -0
- package/lib/generated/idl/TreeWalker.js +255 -0
- package/lib/generated/idl/UIEvent.js +235 -0
- package/lib/generated/idl/UIEventInit.js +62 -0
- package/lib/generated/idl/ValidityState.js +249 -0
- package/lib/generated/idl/VisibilityState.js +12 -0
- package/lib/generated/idl/VoidFunction.js +26 -0
- package/lib/generated/idl/WebSocket.js +480 -0
- package/lib/generated/idl/WheelEvent.js +191 -0
- package/lib/generated/idl/WheelEventInit.js +71 -0
- package/lib/generated/idl/XMLDocument.js +109 -0
- package/lib/generated/idl/XMLHttpRequest.js +663 -0
- package/lib/generated/idl/XMLHttpRequestEventTarget.js +334 -0
- package/lib/generated/idl/XMLHttpRequestResponseType.js +14 -0
- package/lib/generated/idl/XMLHttpRequestUpload.js +109 -0
- package/lib/generated/idl/XMLSerializer.js +132 -0
- package/lib/generated/idl/utils.js +252 -0
- package/lib/generated/js-globals.json +332 -0
- package/lib/jsdom/browser/Window.js +952 -0
- package/lib/jsdom/browser/default-stylesheet.css +415 -0
- package/lib/jsdom/browser/not-implemented.js +20 -0
- package/lib/jsdom/browser/parser/html.js +208 -0
- package/lib/jsdom/browser/parser/index.js +37 -0
- package/lib/jsdom/browser/parser/xml.js +202 -0
- package/lib/jsdom/browser/resources/async-resource-queue.js +114 -0
- package/lib/jsdom/browser/resources/decompress-interceptor.js +184 -0
- package/lib/jsdom/browser/resources/jsdom-dispatcher.js +756 -0
- package/lib/jsdom/browser/resources/per-document-resource-loader.js +116 -0
- package/lib/jsdom/browser/resources/request-interceptor.js +171 -0
- package/lib/jsdom/browser/resources/request-manager.js +33 -0
- package/lib/jsdom/browser/resources/resource-queue.js +142 -0
- package/lib/jsdom/browser/resources/stream-handler.js +89 -0
- package/lib/jsdom/level2/style.js +65 -0
- package/lib/jsdom/level3/xpath.js +1875 -0
- package/lib/jsdom/living/aborting/AbortController-impl.js +17 -0
- package/lib/jsdom/living/aborting/AbortSignal-impl.js +131 -0
- package/lib/jsdom/living/attributes/Attr-impl.js +60 -0
- package/lib/jsdom/living/attributes/NamedNodeMap-impl.js +78 -0
- package/lib/jsdom/living/attributes.js +312 -0
- package/lib/jsdom/living/constraint-validation/DefaultConstraintValidation-impl.js +75 -0
- package/lib/jsdom/living/constraint-validation/ValidityState-impl.js +66 -0
- package/lib/jsdom/living/crypto/Crypto-impl.js +68 -0
- package/lib/jsdom/living/cssom/StyleSheetList-impl.js +38 -0
- package/lib/jsdom/living/custom-elements/CustomElementRegistry-impl.js +279 -0
- package/lib/jsdom/living/custom-elements/ElementInternals-impl.js +56 -0
- package/lib/jsdom/living/deviceorientation/DeviceMotionEventAcceleration-impl.js +7 -0
- package/lib/jsdom/living/deviceorientation/DeviceMotionEventRotationRate-impl.js +7 -0
- package/lib/jsdom/living/documents.js +15 -0
- package/lib/jsdom/living/domparsing/DOMParser-impl.js +59 -0
- package/lib/jsdom/living/domparsing/InnerHTML-impl.js +30 -0
- package/lib/jsdom/living/domparsing/XMLSerializer-impl.js +18 -0
- package/lib/jsdom/living/domparsing/parse5-adapter-serialization.js +63 -0
- package/lib/jsdom/living/domparsing/serialization.js +36 -0
- package/lib/jsdom/living/encoding/TextDecoder-impl.js +25 -0
- package/lib/jsdom/living/encoding/TextEncoder-impl.js +26 -0
- package/lib/jsdom/living/events/BeforeUnloadEvent-impl.js +12 -0
- package/lib/jsdom/living/events/BlobEvent-impl.js +14 -0
- package/lib/jsdom/living/events/CloseEvent-impl.js +10 -0
- package/lib/jsdom/living/events/CompositionEvent-impl.js +20 -0
- package/lib/jsdom/living/events/CustomEvent-impl.js +21 -0
- package/lib/jsdom/living/events/DeviceMotionEvent-impl.js +49 -0
- package/lib/jsdom/living/events/DeviceOrientationEvent-impl.js +10 -0
- package/lib/jsdom/living/events/ErrorEvent-impl.js +14 -0
- package/lib/jsdom/living/events/Event-impl.js +195 -0
- package/lib/jsdom/living/events/EventModifierMixin-impl.js +24 -0
- package/lib/jsdom/living/events/EventTarget-impl.js +438 -0
- package/lib/jsdom/living/events/FocusEvent-impl.js +9 -0
- package/lib/jsdom/living/events/HashChangeEvent-impl.js +14 -0
- package/lib/jsdom/living/events/InputEvent-impl.js +11 -0
- package/lib/jsdom/living/events/KeyboardEvent-impl.js +29 -0
- package/lib/jsdom/living/events/MessageEvent-impl.js +25 -0
- package/lib/jsdom/living/events/MouseEvent-impl.js +72 -0
- package/lib/jsdom/living/events/PageTransitionEvent-impl.js +20 -0
- package/lib/jsdom/living/events/PointerEvent-impl.js +21 -0
- package/lib/jsdom/living/events/PopStateEvent-impl.js +9 -0
- package/lib/jsdom/living/events/ProgressEvent-impl.js +14 -0
- package/lib/jsdom/living/events/PromiseRejectionEvent-impl.js +14 -0
- package/lib/jsdom/living/events/StorageEvent-impl.js +26 -0
- package/lib/jsdom/living/events/SubmitEvent-impl.js +13 -0
- package/lib/jsdom/living/events/TouchEvent-impl.js +14 -0
- package/lib/jsdom/living/events/TransitionEvent-impl.js +10 -0
- package/lib/jsdom/living/events/UIEvent-impl.js +43 -0
- package/lib/jsdom/living/events/WheelEvent-impl.js +12 -0
- package/lib/jsdom/living/fetch/Headers-impl.js +173 -0
- package/lib/jsdom/living/fetch/header-list.js +158 -0
- package/lib/jsdom/living/fetch/header-types.js +205 -0
- package/lib/jsdom/living/fetch/header-utils.js +26 -0
- package/lib/jsdom/living/file-api/Blob-impl.js +125 -0
- package/lib/jsdom/living/file-api/File-impl.js +12 -0
- package/lib/jsdom/living/file-api/FileList-impl.js +15 -0
- package/lib/jsdom/living/file-api/FileReader-impl.js +148 -0
- package/lib/jsdom/living/geometry/DOMRect-impl.js +39 -0
- package/lib/jsdom/living/geometry/DOMRectReadOnly-impl.js +72 -0
- package/lib/jsdom/living/helpers/binary-data.js +63 -0
- package/lib/jsdom/living/helpers/by-id-cache.js +67 -0
- package/lib/jsdom/living/helpers/colors.js +245 -0
- package/lib/jsdom/living/helpers/create-element.js +329 -0
- package/lib/jsdom/living/helpers/create-event-accessor.js +209 -0
- package/lib/jsdom/living/helpers/custom-elements.js +272 -0
- package/lib/jsdom/living/helpers/dates-and-times.js +270 -0
- package/lib/jsdom/living/helpers/details.js +15 -0
- package/lib/jsdom/living/helpers/encoding.js +60 -0
- package/lib/jsdom/living/helpers/events.js +24 -0
- package/lib/jsdom/living/helpers/focusing.js +104 -0
- package/lib/jsdom/living/helpers/form-controls.js +309 -0
- package/lib/jsdom/living/helpers/html-constructor.js +78 -0
- package/lib/jsdom/living/helpers/internal-constants.js +12 -0
- package/lib/jsdom/living/helpers/is-window.js +18 -0
- package/lib/jsdom/living/helpers/iterable-weak-set.js +48 -0
- package/lib/jsdom/living/helpers/json.js +7 -0
- package/lib/jsdom/living/helpers/mutation-observers.js +198 -0
- package/lib/jsdom/living/helpers/namespaces.js +16 -0
- package/lib/jsdom/living/helpers/node.js +108 -0
- package/lib/jsdom/living/helpers/number-and-date-inputs.js +195 -0
- package/lib/jsdom/living/helpers/ordered-set.js +104 -0
- package/lib/jsdom/living/helpers/page-transition-event.js +9 -0
- package/lib/jsdom/living/helpers/runtime-script-errors.js +75 -0
- package/lib/jsdom/living/helpers/shadow-dom.js +285 -0
- package/lib/jsdom/living/helpers/strings.js +168 -0
- package/lib/jsdom/living/helpers/style-rules.js +404 -0
- package/lib/jsdom/living/helpers/stylesheets.js +148 -0
- package/lib/jsdom/living/helpers/svg/basic-types.js +41 -0
- package/lib/jsdom/living/helpers/svg/render.js +46 -0
- package/lib/jsdom/living/helpers/system-colors.js +147 -0
- package/lib/jsdom/living/helpers/text.js +19 -0
- package/lib/jsdom/living/helpers/traversal.js +72 -0
- package/lib/jsdom/living/helpers/validate-names.js +65 -0
- package/lib/jsdom/living/hr-time/Performance-impl.js +22 -0
- package/lib/jsdom/living/interfaces.js +252 -0
- package/lib/jsdom/living/mutation-observer/MutationObserver-impl.js +95 -0
- package/lib/jsdom/living/mutation-observer/MutationRecord-impl.js +37 -0
- package/lib/jsdom/living/navigator/MimeType-impl.js +3 -0
- package/lib/jsdom/living/navigator/MimeTypeArray-impl.js +21 -0
- package/lib/jsdom/living/navigator/Navigator-impl.js +29 -0
- package/lib/jsdom/living/navigator/NavigatorConcurrentHardware-impl.js +8 -0
- package/lib/jsdom/living/navigator/NavigatorCookies-impl.js +7 -0
- package/lib/jsdom/living/navigator/NavigatorID-impl.js +37 -0
- package/lib/jsdom/living/navigator/NavigatorLanguage-impl.js +9 -0
- package/lib/jsdom/living/navigator/NavigatorOnLine-impl.js +7 -0
- package/lib/jsdom/living/navigator/NavigatorPlugins-impl.js +8 -0
- package/lib/jsdom/living/navigator/Plugin-impl.js +3 -0
- package/lib/jsdom/living/navigator/PluginArray-impl.js +23 -0
- package/lib/jsdom/living/node-document-position.js +10 -0
- package/lib/jsdom/living/node-type.js +16 -0
- package/lib/jsdom/living/node.js +331 -0
- package/lib/jsdom/living/nodes/CDATASection-impl.js +16 -0
- package/lib/jsdom/living/nodes/CharacterData-impl.js +118 -0
- package/lib/jsdom/living/nodes/ChildNode-impl.js +80 -0
- package/lib/jsdom/living/nodes/Comment-impl.js +20 -0
- package/lib/jsdom/living/nodes/DOMImplementation-impl.js +120 -0
- package/lib/jsdom/living/nodes/DOMStringMap-impl.js +64 -0
- package/lib/jsdom/living/nodes/DOMTokenList-impl.js +171 -0
- package/lib/jsdom/living/nodes/Document-impl.js +1000 -0
- package/lib/jsdom/living/nodes/DocumentFragment-impl.js +44 -0
- package/lib/jsdom/living/nodes/DocumentOrShadowRoot-impl.js +28 -0
- package/lib/jsdom/living/nodes/DocumentType-impl.js +24 -0
- package/lib/jsdom/living/nodes/Element-impl.js +584 -0
- package/lib/jsdom/living/nodes/ElementCSSInlineStyle-impl.js +22 -0
- package/lib/jsdom/living/nodes/ElementContentEditable-impl.js +7 -0
- package/lib/jsdom/living/nodes/GlobalEventHandlers-impl.js +81 -0
- package/lib/jsdom/living/nodes/HTMLAnchorElement-impl.js +50 -0
- package/lib/jsdom/living/nodes/HTMLAreaElement-impl.js +43 -0
- package/lib/jsdom/living/nodes/HTMLAudioElement-impl.js +9 -0
- package/lib/jsdom/living/nodes/HTMLBRElement-impl.js +9 -0
- package/lib/jsdom/living/nodes/HTMLBaseElement-impl.js +44 -0
- package/lib/jsdom/living/nodes/HTMLBodyElement-impl.js +12 -0
- package/lib/jsdom/living/nodes/HTMLButtonElement-impl.js +79 -0
- package/lib/jsdom/living/nodes/HTMLCanvasElement-impl.js +136 -0
- package/lib/jsdom/living/nodes/HTMLCollection-impl.js +96 -0
- package/lib/jsdom/living/nodes/HTMLDListElement-impl.js +9 -0
- package/lib/jsdom/living/nodes/HTMLDataElement-impl.js +9 -0
- package/lib/jsdom/living/nodes/HTMLDataListElement-impl.js +20 -0
- package/lib/jsdom/living/nodes/HTMLDetailsElement-impl.js +35 -0
- package/lib/jsdom/living/nodes/HTMLDialogElement-impl.js +9 -0
- package/lib/jsdom/living/nodes/HTMLDirectoryElement-impl.js +9 -0
- package/lib/jsdom/living/nodes/HTMLDivElement-impl.js +9 -0
- package/lib/jsdom/living/nodes/HTMLElement-impl.js +211 -0
- package/lib/jsdom/living/nodes/HTMLEmbedElement-impl.js +8 -0
- package/lib/jsdom/living/nodes/HTMLFieldSetElement-impl.js +43 -0
- package/lib/jsdom/living/nodes/HTMLFontElement-impl.js +9 -0
- package/lib/jsdom/living/nodes/HTMLFormControlsCollection-impl.js +33 -0
- package/lib/jsdom/living/nodes/HTMLFormElement-impl.js +248 -0
- package/lib/jsdom/living/nodes/HTMLFrameElement-impl.js +266 -0
- package/lib/jsdom/living/nodes/HTMLFrameSetElement-impl.js +12 -0
- package/lib/jsdom/living/nodes/HTMLHRElement-impl.js +9 -0
- package/lib/jsdom/living/nodes/HTMLHeadElement-impl.js +9 -0
- package/lib/jsdom/living/nodes/HTMLHeadingElement-impl.js +9 -0
- package/lib/jsdom/living/nodes/HTMLHtmlElement-impl.js +9 -0
- package/lib/jsdom/living/nodes/HTMLHyperlinkElementUtils-impl.js +368 -0
- package/lib/jsdom/living/nodes/HTMLIFrameElement-impl.js +9 -0
- package/lib/jsdom/living/nodes/HTMLImageElement-impl.js +127 -0
- package/lib/jsdom/living/nodes/HTMLInputElement-impl.js +1097 -0
- package/lib/jsdom/living/nodes/HTMLLIElement-impl.js +9 -0
- package/lib/jsdom/living/nodes/HTMLLabelElement-impl.js +94 -0
- package/lib/jsdom/living/nodes/HTMLLegendElement-impl.js +18 -0
- package/lib/jsdom/living/nodes/HTMLLinkElement-impl.js +107 -0
- package/lib/jsdom/living/nodes/HTMLMapElement-impl.js +13 -0
- package/lib/jsdom/living/nodes/HTMLMarqueeElement-impl.js +9 -0
- package/lib/jsdom/living/nodes/HTMLMediaElement-impl.js +138 -0
- package/lib/jsdom/living/nodes/HTMLMenuElement-impl.js +9 -0
- package/lib/jsdom/living/nodes/HTMLMetaElement-impl.js +9 -0
- package/lib/jsdom/living/nodes/HTMLMeterElement-impl.js +180 -0
- package/lib/jsdom/living/nodes/HTMLModElement-impl.js +9 -0
- package/lib/jsdom/living/nodes/HTMLOListElement-impl.js +22 -0
- package/lib/jsdom/living/nodes/HTMLObjectElement-impl.js +26 -0
- package/lib/jsdom/living/nodes/HTMLOptGroupElement-impl.js +9 -0
- package/lib/jsdom/living/nodes/HTMLOptionElement-impl.js +146 -0
- package/lib/jsdom/living/nodes/HTMLOptionsCollection-impl.js +110 -0
- package/lib/jsdom/living/nodes/HTMLOrSVGElement-impl.js +88 -0
- package/lib/jsdom/living/nodes/HTMLOutputElement-impl.js +88 -0
- package/lib/jsdom/living/nodes/HTMLParagraphElement-impl.js +9 -0
- package/lib/jsdom/living/nodes/HTMLParamElement-impl.js +9 -0
- package/lib/jsdom/living/nodes/HTMLPictureElement-impl.js +9 -0
- package/lib/jsdom/living/nodes/HTMLPreElement-impl.js +9 -0
- package/lib/jsdom/living/nodes/HTMLProgressElement-impl.js +72 -0
- package/lib/jsdom/living/nodes/HTMLQuoteElement-impl.js +9 -0
- package/lib/jsdom/living/nodes/HTMLScriptElement-impl.js +255 -0
- package/lib/jsdom/living/nodes/HTMLSelectElement-impl.js +283 -0
- package/lib/jsdom/living/nodes/HTMLSlotElement-impl.js +59 -0
- package/lib/jsdom/living/nodes/HTMLSourceElement-impl.js +8 -0
- package/lib/jsdom/living/nodes/HTMLSpanElement-impl.js +9 -0
- package/lib/jsdom/living/nodes/HTMLStyleElement-impl.js +76 -0
- package/lib/jsdom/living/nodes/HTMLTableCaptionElement-impl.js +9 -0
- package/lib/jsdom/living/nodes/HTMLTableCellElement-impl.js +73 -0
- package/lib/jsdom/living/nodes/HTMLTableColElement-impl.js +9 -0
- package/lib/jsdom/living/nodes/HTMLTableElement-impl.js +236 -0
- package/lib/jsdom/living/nodes/HTMLTableRowElement-impl.js +88 -0
- package/lib/jsdom/living/nodes/HTMLTableSectionElement-impl.js +61 -0
- package/lib/jsdom/living/nodes/HTMLTemplateElement-impl.js +67 -0
- package/lib/jsdom/living/nodes/HTMLTextAreaElement-impl.js +244 -0
- package/lib/jsdom/living/nodes/HTMLTimeElement-impl.js +9 -0
- package/lib/jsdom/living/nodes/HTMLTitleElement-impl.js +18 -0
- package/lib/jsdom/living/nodes/HTMLTrackElement-impl.js +13 -0
- package/lib/jsdom/living/nodes/HTMLUListElement-impl.js +9 -0
- package/lib/jsdom/living/nodes/HTMLUnknownElement-impl.js +9 -0
- package/lib/jsdom/living/nodes/HTMLVideoElement-impl.js +17 -0
- package/lib/jsdom/living/nodes/LinkStyle-impl.js +2 -0
- package/lib/jsdom/living/nodes/Node-impl.js +1179 -0
- package/lib/jsdom/living/nodes/NodeList-impl.js +43 -0
- package/lib/jsdom/living/nodes/NonDocumentTypeChildNode-impl.js +28 -0
- package/lib/jsdom/living/nodes/NonElementParentNode-impl.js +11 -0
- package/lib/jsdom/living/nodes/ParentNode-impl.js +90 -0
- package/lib/jsdom/living/nodes/ProcessingInstruction-impl.js +22 -0
- package/lib/jsdom/living/nodes/RadioNodeList-impl.js +49 -0
- package/lib/jsdom/living/nodes/SVGDefsElement-impl.js +9 -0
- package/lib/jsdom/living/nodes/SVGDescElement-impl.js +9 -0
- package/lib/jsdom/living/nodes/SVGElement-impl.js +64 -0
- package/lib/jsdom/living/nodes/SVGGElement-impl.js +9 -0
- package/lib/jsdom/living/nodes/SVGGraphicsElement-impl.js +16 -0
- package/lib/jsdom/living/nodes/SVGMetadataElement-impl.js +9 -0
- package/lib/jsdom/living/nodes/SVGSVGElement-impl.js +40 -0
- package/lib/jsdom/living/nodes/SVGSwitchElement-impl.js +9 -0
- package/lib/jsdom/living/nodes/SVGSymbolElement-impl.js +9 -0
- package/lib/jsdom/living/nodes/SVGTests-impl.js +42 -0
- package/lib/jsdom/living/nodes/SVGTitleElement-impl.js +9 -0
- package/lib/jsdom/living/nodes/ShadowRoot-impl.js +41 -0
- package/lib/jsdom/living/nodes/Slotable-impl.js +48 -0
- package/lib/jsdom/living/nodes/Text-impl.js +96 -0
- package/lib/jsdom/living/nodes/WindowEventHandlers-impl.js +14 -0
- package/lib/jsdom/living/nodes/XMLDocument-impl.js +4 -0
- package/lib/jsdom/living/range/AbstractRange-impl.js +43 -0
- package/lib/jsdom/living/range/Range-impl.js +902 -0
- package/lib/jsdom/living/range/StaticRange-impl.js +39 -0
- package/lib/jsdom/living/range/boundary-point.js +47 -0
- package/lib/jsdom/living/selection/Selection-impl.js +358 -0
- package/lib/jsdom/living/svg/SVGAnimatedPreserveAspectRatio-impl.js +24 -0
- package/lib/jsdom/living/svg/SVGAnimatedRect-impl.js +122 -0
- package/lib/jsdom/living/svg/SVGAnimatedString-impl.js +42 -0
- package/lib/jsdom/living/svg/SVGListBase.js +195 -0
- package/lib/jsdom/living/svg/SVGNumber-impl.js +48 -0
- package/lib/jsdom/living/svg/SVGPreserveAspectRatio-impl.js +100 -0
- package/lib/jsdom/living/svg/SVGRect-impl.js +143 -0
- package/lib/jsdom/living/svg/SVGStringList-impl.js +16 -0
- package/lib/jsdom/living/traversal/NodeIterator-impl.js +107 -0
- package/lib/jsdom/living/traversal/TreeWalker-impl.js +217 -0
- package/lib/jsdom/living/traversal/helpers.js +44 -0
- package/lib/jsdom/living/webidl/DOMException-impl.js +46 -0
- package/lib/jsdom/living/websockets/WebSocket-impl.js +211 -0
- package/lib/jsdom/living/webstorage/Storage-impl.js +102 -0
- package/lib/jsdom/living/window/BarProp-impl.js +10 -0
- package/lib/jsdom/living/window/External-impl.js +9 -0
- package/lib/jsdom/living/window/History-impl.js +148 -0
- package/lib/jsdom/living/window/Location-impl.js +227 -0
- package/lib/jsdom/living/window/Screen-impl.js +13 -0
- package/lib/jsdom/living/window/SessionHistory.js +163 -0
- package/lib/jsdom/living/window/navigation.js +87 -0
- package/lib/jsdom/living/window-properties.js +241 -0
- package/lib/jsdom/living/xhr/FormData-impl.js +191 -0
- package/lib/jsdom/living/xhr/XMLHttpRequest-impl.js +1057 -0
- package/lib/jsdom/living/xhr/XMLHttpRequestEventTarget-impl.js +17 -0
- package/lib/jsdom/living/xhr/XMLHttpRequestUpload-impl.js +4 -0
- package/lib/jsdom/living/xhr/multipart-form-data.js +99 -0
- package/lib/jsdom/living/xhr/xhr-sync-worker.js +51 -0
- package/lib/jsdom/living/xhr/xhr-utils.js +206 -0
- package/lib/jsdom/utils.js +105 -0
- package/lib/jsdom/virtual-console.js +46 -0
- package/package.json +143 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { appendHandler, createEventAccessor } = require("../helpers/create-event-accessor");
|
|
4
|
+
const { globalEventHandlersEvents, windowEventHandlersEvents } = require("../../../generated/event-sets");
|
|
5
|
+
|
|
6
|
+
// These events are specified on GlobalEventHandlers but, per the HTML spec, are reflected on the Window from the body
|
|
7
|
+
// element. They are not derivable from the IDL alone.
|
|
8
|
+
const windowReflectingBodyElementEvents = new Set(["blur", "error", "focus", "load", "resize", "scroll"]);
|
|
9
|
+
|
|
10
|
+
class GlobalEventHandlersImpl {
|
|
11
|
+
_initGlobalEvents() {
|
|
12
|
+
this._registeredHandlers = new Set();
|
|
13
|
+
this._eventHandlers = Object.create(null);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
_getEventHandlerTarget(event) {
|
|
17
|
+
// https://html.spec.whatwg.org/multipage/webappapis.html#determining-the-target-of-an-event-handler
|
|
18
|
+
|
|
19
|
+
// Step 1
|
|
20
|
+
if (this._localName !== "body" && this._localName !== "frameset") {
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Step 2
|
|
25
|
+
if (!windowEventHandlersEvents.has(event) && !windowReflectingBodyElementEvents.has(event)) {
|
|
26
|
+
return this;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Step 3 + 4
|
|
30
|
+
const window = this._ownerDocument._defaultView;
|
|
31
|
+
return window || null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
_getEventHandlerFor(event) {
|
|
35
|
+
const target = this._getEventHandlerTarget(event);
|
|
36
|
+
if (!target) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return target._eventHandlers[event];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
_setEventHandlerFor(event, handler) {
|
|
44
|
+
const target = this._getEventHandlerTarget(event);
|
|
45
|
+
if (!target) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (!target._registeredHandlers.has(event) && handler !== null) {
|
|
50
|
+
target._registeredHandlers.add(event);
|
|
51
|
+
appendHandler(target, event);
|
|
52
|
+
}
|
|
53
|
+
target._eventHandlers[event] = handler;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
_globalEventChanged(event) {
|
|
57
|
+
const propName = "on" + event;
|
|
58
|
+
if (!(propName in this)) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Only translate attribute changes into properties when runScripts: "dangerously" is set.
|
|
63
|
+
// Documents without a browsing context (i.e. without a _defaultView) never run scripts.
|
|
64
|
+
const runScripts = "_runScripts" in this ? this._runScripts : (this._ownerDocument._defaultView || {})._runScripts;
|
|
65
|
+
if (runScripts !== "dangerously") {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const val = this.getAttributeNS(null, propName);
|
|
70
|
+
const handler = val === null ? null : { body: val };
|
|
71
|
+
this._setEventHandlerFor(event, handler);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
for (const event of globalEventHandlersEvents) {
|
|
76
|
+
createEventAccessor(GlobalEventHandlersImpl.prototype, event);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
module.exports = {
|
|
80
|
+
implementation: GlobalEventHandlersImpl
|
|
81
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const { mixin } = require("../../utils");
|
|
3
|
+
const DOMTokenList = require("../../../generated/idl/DOMTokenList");
|
|
4
|
+
const HTMLElementImpl = require("./HTMLElement-impl").implementation;
|
|
5
|
+
const HTMLHyperlinkElementUtilsImpl = require("./HTMLHyperlinkElementUtils-impl").implementation;
|
|
6
|
+
|
|
7
|
+
class HTMLAnchorElementImpl extends HTMLElementImpl {
|
|
8
|
+
constructor(globalObject, args, privateData) {
|
|
9
|
+
super(globalObject, args, privateData);
|
|
10
|
+
|
|
11
|
+
this._htmlHyperlinkElementUtilsSetup();
|
|
12
|
+
|
|
13
|
+
this._hasActivationBehavior = true;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
_activationBehavior() {
|
|
17
|
+
this._followAHyperlink();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
get relList() {
|
|
21
|
+
if (this._relList === undefined) {
|
|
22
|
+
this._relList = DOMTokenList.createImpl(this._globalObject, [], {
|
|
23
|
+
element: this,
|
|
24
|
+
attributeLocalName: "rel"
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return this._relList;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
get text() {
|
|
31
|
+
return this.textContent;
|
|
32
|
+
}
|
|
33
|
+
set text(v) {
|
|
34
|
+
this.textContent = v;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
_attrModified(name, value, oldValue) {
|
|
38
|
+
super._attrModified(name, value, oldValue);
|
|
39
|
+
|
|
40
|
+
if (name === "rel" && this._relList !== undefined) {
|
|
41
|
+
this._relList.attrModified();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
mixin(HTMLAnchorElementImpl.prototype, HTMLHyperlinkElementUtilsImpl.prototype);
|
|
47
|
+
|
|
48
|
+
module.exports = {
|
|
49
|
+
implementation: HTMLAnchorElementImpl
|
|
50
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const { mixin } = require("../../utils");
|
|
3
|
+
const DOMTokenList = require("../../../generated/idl/DOMTokenList");
|
|
4
|
+
const HTMLElementImpl = require("./HTMLElement-impl").implementation;
|
|
5
|
+
const HTMLHyperlinkElementUtilsImpl = require("./HTMLHyperlinkElementUtils-impl").implementation;
|
|
6
|
+
|
|
7
|
+
class HTMLAreaElementImpl extends HTMLElementImpl {
|
|
8
|
+
constructor(globalObject, args, privateData) {
|
|
9
|
+
super(globalObject, args, privateData);
|
|
10
|
+
|
|
11
|
+
this._htmlHyperlinkElementUtilsSetup();
|
|
12
|
+
|
|
13
|
+
this._hasActivationBehavior = true;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
_activationBehavior() {
|
|
17
|
+
this._followAHyperlink();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
get relList() {
|
|
21
|
+
if (this._relList === undefined) {
|
|
22
|
+
this._relList = DOMTokenList.createImpl(this._globalObject, [], {
|
|
23
|
+
element: this,
|
|
24
|
+
attributeLocalName: "rel"
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return this._relList;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
_attrModified(name, value, oldValue) {
|
|
31
|
+
super._attrModified(name, value, oldValue);
|
|
32
|
+
|
|
33
|
+
if (name === "rel" && this._relList !== undefined) {
|
|
34
|
+
this._relList.attrModified();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
mixin(HTMLAreaElementImpl.prototype, HTMLHyperlinkElementUtilsImpl.prototype);
|
|
40
|
+
|
|
41
|
+
module.exports = {
|
|
42
|
+
implementation: HTMLAreaElementImpl
|
|
43
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const whatwgURL = require("whatwg-url");
|
|
3
|
+
const HTMLElementImpl = require("./HTMLElement-impl").implementation;
|
|
4
|
+
|
|
5
|
+
class HTMLBaseElementImpl extends HTMLElementImpl {
|
|
6
|
+
get href() {
|
|
7
|
+
const document = this._ownerDocument;
|
|
8
|
+
|
|
9
|
+
const url = this.hasAttributeNS(null, "href") ? this.getAttributeNS(null, "href") : "";
|
|
10
|
+
const parsed = whatwgURL.parseURL(url, { baseURL: document._fallbackBaseURL() });
|
|
11
|
+
|
|
12
|
+
if (parsed === null) {
|
|
13
|
+
return url;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return whatwgURL.serializeURL(parsed);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
set href(value) {
|
|
20
|
+
this.setAttributeNS(null, "href", value);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
_attrModified(name, value, oldValue) {
|
|
24
|
+
super._attrModified(name, value, oldValue);
|
|
25
|
+
|
|
26
|
+
if (name === "href") {
|
|
27
|
+
this._ownerDocument._clearBaseURLCache();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
_attach() {
|
|
32
|
+
super._attach();
|
|
33
|
+
this._ownerDocument._clearBaseURLCache();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
_detach() {
|
|
37
|
+
super._detach();
|
|
38
|
+
this._ownerDocument._clearBaseURLCache();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
module.exports = {
|
|
43
|
+
implementation: HTMLBaseElementImpl
|
|
44
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const { mixin } = require("../../utils");
|
|
3
|
+
const HTMLElementImpl = require("./HTMLElement-impl").implementation;
|
|
4
|
+
const WindowEventHandlersImpl = require("./WindowEventHandlers-impl").implementation;
|
|
5
|
+
|
|
6
|
+
class HTMLBodyElementImpl extends HTMLElementImpl {}
|
|
7
|
+
|
|
8
|
+
mixin(HTMLBodyElementImpl.prototype, WindowEventHandlersImpl.prototype);
|
|
9
|
+
|
|
10
|
+
module.exports = {
|
|
11
|
+
implementation: HTMLBodyElementImpl
|
|
12
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const HTMLElementImpl = require("./HTMLElement-impl").implementation;
|
|
3
|
+
const DefaultConstraintValidationImpl =
|
|
4
|
+
require("../constraint-validation/DefaultConstraintValidation-impl").implementation;
|
|
5
|
+
const { mixin } = require("../../utils");
|
|
6
|
+
const { isDisabled, formOwner, getLabelsForLabelable } = require("../helpers/form-controls");
|
|
7
|
+
const { asciiLowercase } = require("../helpers/strings");
|
|
8
|
+
|
|
9
|
+
class HTMLButtonElementImpl extends HTMLElementImpl {
|
|
10
|
+
constructor(globalObject, args, privateData) {
|
|
11
|
+
super(globalObject, args, privateData);
|
|
12
|
+
|
|
13
|
+
this._customValidityErrorMessage = "";
|
|
14
|
+
this._labels = null;
|
|
15
|
+
|
|
16
|
+
this._hasActivationBehavior = true;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
_activationBehavior() {
|
|
20
|
+
const { form } = this;
|
|
21
|
+
if (form && !isDisabled(this)) {
|
|
22
|
+
if (this.type === "submit") {
|
|
23
|
+
form._doRequestSubmit(this);
|
|
24
|
+
}
|
|
25
|
+
if (this.type === "reset") {
|
|
26
|
+
form._doReset();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
_getValue() {
|
|
32
|
+
const valueAttr = this.getAttributeNS(null, "value");
|
|
33
|
+
return valueAttr === null ? "" : valueAttr;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
get labels() {
|
|
37
|
+
return getLabelsForLabelable(this);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
get form() {
|
|
41
|
+
return formOwner(this);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
get type() {
|
|
45
|
+
const typeAttr = asciiLowercase(this.getAttributeNS(null, "type") || "");
|
|
46
|
+
switch (typeAttr) {
|
|
47
|
+
case "submit":
|
|
48
|
+
case "reset":
|
|
49
|
+
case "button":
|
|
50
|
+
return typeAttr;
|
|
51
|
+
default:
|
|
52
|
+
return "submit";
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
set type(v) {
|
|
57
|
+
v = asciiLowercase(String(v));
|
|
58
|
+
switch (v) {
|
|
59
|
+
case "submit":
|
|
60
|
+
case "reset":
|
|
61
|
+
case "button":
|
|
62
|
+
this.setAttributeNS(null, "type", v);
|
|
63
|
+
break;
|
|
64
|
+
default:
|
|
65
|
+
this.setAttributeNS(null, "type", "submit");
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
_barredFromConstraintValidationSpecialization() {
|
|
71
|
+
return this.type === "reset" || this.type === "button";
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
mixin(HTMLButtonElementImpl.prototype, DefaultConstraintValidationImpl.prototype);
|
|
76
|
+
|
|
77
|
+
module.exports = {
|
|
78
|
+
implementation: HTMLButtonElementImpl
|
|
79
|
+
};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const HTMLElementImpl = require("./HTMLElement-impl").implementation;
|
|
3
|
+
const { notImplementedMethod } = require("../../browser/not-implemented");
|
|
4
|
+
const idlUtils = require("../../../generated/idl/utils");
|
|
5
|
+
const { Canvas } = require("../../utils");
|
|
6
|
+
|
|
7
|
+
class HTMLCanvasElementImpl extends HTMLElementImpl {
|
|
8
|
+
_attrModified(name, value, oldValue) {
|
|
9
|
+
if (this._canvas && (name === "width" || name === "height")) {
|
|
10
|
+
this._canvas[name] = parseInt(value);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
super._attrModified(name, value, oldValue);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
_getCanvas() {
|
|
17
|
+
if (Canvas && !this._canvas) {
|
|
18
|
+
this._canvas = Canvas.createCanvas(this.width, this.height);
|
|
19
|
+
}
|
|
20
|
+
return this._canvas;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
getContext(contextId) {
|
|
24
|
+
const canvas = this._getCanvas();
|
|
25
|
+
if (canvas) {
|
|
26
|
+
if (!this._context) {
|
|
27
|
+
this._context = canvas.getContext(contextId) || null;
|
|
28
|
+
if (this._context) {
|
|
29
|
+
// Override the native canvas reference with our wrapper. This is the
|
|
30
|
+
// reason why we need to locally cache _context, since each call to
|
|
31
|
+
// canvas.getContext(contextId) would replace this reference again.
|
|
32
|
+
// Perhaps in the longer term, a better solution would be to create a
|
|
33
|
+
// full wrapper for the Context object as well.
|
|
34
|
+
this._context.canvas = idlUtils.wrapperForImpl(this);
|
|
35
|
+
wrapNodeCanvasMethod(this._context, "createPattern");
|
|
36
|
+
wrapNodeCanvasMethod(this._context, "drawImage");
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return this._context;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
notImplementedMethod(
|
|
43
|
+
this._ownerDocument._defaultView,
|
|
44
|
+
"HTMLCanvasElement",
|
|
45
|
+
"getContext",
|
|
46
|
+
"without installing the canvas npm package"
|
|
47
|
+
);
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
toDataURL(...args) {
|
|
52
|
+
const canvas = this._getCanvas();
|
|
53
|
+
if (canvas) {
|
|
54
|
+
return canvas.toDataURL(...args);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
notImplementedMethod(
|
|
58
|
+
this._ownerDocument._defaultView,
|
|
59
|
+
"HTMLCanvasElement",
|
|
60
|
+
"toDataURL",
|
|
61
|
+
"without installing the canvas npm package"
|
|
62
|
+
);
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
toBlob(callback, type, qualityArgument) {
|
|
67
|
+
const window = this._ownerDocument._defaultView;
|
|
68
|
+
const canvas = this._getCanvas();
|
|
69
|
+
if (canvas) {
|
|
70
|
+
const options = {};
|
|
71
|
+
switch (type) {
|
|
72
|
+
case "image/jpg":
|
|
73
|
+
case "image/jpeg":
|
|
74
|
+
type = "image/jpeg";
|
|
75
|
+
options.quality = qualityArgument;
|
|
76
|
+
break;
|
|
77
|
+
default:
|
|
78
|
+
type = "image/png";
|
|
79
|
+
}
|
|
80
|
+
canvas.toBuffer((err, buff) => {
|
|
81
|
+
if (err) {
|
|
82
|
+
throw err;
|
|
83
|
+
}
|
|
84
|
+
callback(new window.Blob([buff], { type }));
|
|
85
|
+
}, type, options);
|
|
86
|
+
} else {
|
|
87
|
+
notImplementedMethod(
|
|
88
|
+
this._ownerDocument._defaultView,
|
|
89
|
+
"HTMLCanvasElement",
|
|
90
|
+
"toBlob",
|
|
91
|
+
"without installing the canvas npm package"
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
get width() {
|
|
97
|
+
const parsed = parseInt(this.getAttributeNS(null, "width"));
|
|
98
|
+
return isNaN(parsed) || parsed < 0 || parsed > 2147483647 ? 300 : parsed;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
set width(v) {
|
|
102
|
+
v = v > 2147483647 ? 300 : v;
|
|
103
|
+
this.setAttributeNS(null, "width", String(v));
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
get height() {
|
|
107
|
+
const parsed = parseInt(this.getAttributeNS(null, "height"));
|
|
108
|
+
return isNaN(parsed) || parsed < 0 || parsed > 2147483647 ? 150 : parsed;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
set height(v) {
|
|
112
|
+
v = v > 2147483647 ? 150 : v;
|
|
113
|
+
this.setAttributeNS(null, "height", String(v));
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// We need to wrap the methods that receive an image or canvas object
|
|
118
|
+
// (luckily, always as the first argument), so that these objects can be
|
|
119
|
+
// unwrapped an the expected types passed.
|
|
120
|
+
function wrapNodeCanvasMethod(ctx, name) {
|
|
121
|
+
const prev = ctx[name];
|
|
122
|
+
ctx[name] = function (image, ...rest) {
|
|
123
|
+
const impl = idlUtils.implForWrapper(image);
|
|
124
|
+
if (impl) {
|
|
125
|
+
if (impl instanceof HTMLCanvasElementImpl && !impl._canvas) {
|
|
126
|
+
impl._getCanvas();
|
|
127
|
+
}
|
|
128
|
+
image = impl._image || impl._canvas;
|
|
129
|
+
}
|
|
130
|
+
return prev.call(ctx, image, ...rest);
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
module.exports = {
|
|
135
|
+
implementation: HTMLCanvasElementImpl
|
|
136
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const idlUtils = require("../../../generated/idl/utils.js");
|
|
4
|
+
const { HTML_NS } = require("../helpers/namespaces");
|
|
5
|
+
|
|
6
|
+
exports.implementation = class HTMLCollectionImpl {
|
|
7
|
+
constructor(globalObject, args, privateData) {
|
|
8
|
+
this._list = [];
|
|
9
|
+
this._version = -1;
|
|
10
|
+
this._element = privateData.element;
|
|
11
|
+
this._query = privateData.query;
|
|
12
|
+
|
|
13
|
+
this._globalObject = globalObject;
|
|
14
|
+
|
|
15
|
+
this._update();
|
|
16
|
+
}
|
|
17
|
+
get length() {
|
|
18
|
+
this._update();
|
|
19
|
+
return this._list.length;
|
|
20
|
+
}
|
|
21
|
+
item(index) {
|
|
22
|
+
this._update();
|
|
23
|
+
return this._list[index] || null;
|
|
24
|
+
}
|
|
25
|
+
namedItem(key) {
|
|
26
|
+
if (key === "") {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
this._update();
|
|
30
|
+
for (const element of this._list) {
|
|
31
|
+
if (element.getAttributeNS(null, "id") === key) {
|
|
32
|
+
return element;
|
|
33
|
+
}
|
|
34
|
+
if (element._namespaceURI === HTML_NS) {
|
|
35
|
+
const name = element.getAttributeNS(null, "name");
|
|
36
|
+
if (name === key) {
|
|
37
|
+
return element;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
_update() {
|
|
44
|
+
if (this._version < this._element._version) {
|
|
45
|
+
const snapshot = this._query();
|
|
46
|
+
for (let i = 0; i < snapshot.length; i++) {
|
|
47
|
+
this._list[i] = snapshot[i];
|
|
48
|
+
}
|
|
49
|
+
this._list.length = snapshot.length;
|
|
50
|
+
this._version = this._element._version;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
get [idlUtils.supportedPropertyIndices]() {
|
|
54
|
+
this._update();
|
|
55
|
+
return this._list.keys();
|
|
56
|
+
}
|
|
57
|
+
get [idlUtils.supportedPropertyNames]() {
|
|
58
|
+
this._update();
|
|
59
|
+
const result = new Set();
|
|
60
|
+
for (const element of this._list) {
|
|
61
|
+
const id = element.getAttributeNS(null, "id");
|
|
62
|
+
if (id) {
|
|
63
|
+
result.add(id);
|
|
64
|
+
}
|
|
65
|
+
if (element._namespaceURI === HTML_NS) {
|
|
66
|
+
const name = element.getAttributeNS(null, "name");
|
|
67
|
+
if (name) {
|
|
68
|
+
result.add(name);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return result;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Inherit some useful functions from Array.
|
|
76
|
+
[Symbol.iterator]() {
|
|
77
|
+
this._update();
|
|
78
|
+
return this._list[Symbol.iterator]();
|
|
79
|
+
}
|
|
80
|
+
entries() {
|
|
81
|
+
this._update();
|
|
82
|
+
return this._list.entries();
|
|
83
|
+
}
|
|
84
|
+
filter(...args) {
|
|
85
|
+
this._update();
|
|
86
|
+
return this._list.filter(...args);
|
|
87
|
+
}
|
|
88
|
+
map(...args) {
|
|
89
|
+
this._update();
|
|
90
|
+
return this._list.map(...args);
|
|
91
|
+
}
|
|
92
|
+
indexOf(...args) {
|
|
93
|
+
this._update();
|
|
94
|
+
return this._list.indexOf(...args);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const HTMLCollection = require("../../../generated/idl/HTMLCollection");
|
|
4
|
+
const HTMLElementImpl = require("./HTMLElement-impl").implementation;
|
|
5
|
+
|
|
6
|
+
const { descendantsByLocalName } = require("../helpers/traversal");
|
|
7
|
+
|
|
8
|
+
class HTMLDataListElementImpl extends HTMLElementImpl {
|
|
9
|
+
// https://html.spec.whatwg.org/multipage/form-elements.html#dom-datalist-options
|
|
10
|
+
get options() {
|
|
11
|
+
return HTMLCollection.createImpl(this._globalObject, [], {
|
|
12
|
+
element: this,
|
|
13
|
+
query: () => descendantsByLocalName(this, "option")
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
module.exports = {
|
|
19
|
+
implementation: HTMLDataListElementImpl
|
|
20
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { fireAnEvent } = require("../helpers/events");
|
|
4
|
+
|
|
5
|
+
const HTMLElementImpl = require("./HTMLElement-impl").implementation;
|
|
6
|
+
|
|
7
|
+
class HTMLDetailsElementImpl extends HTMLElementImpl {
|
|
8
|
+
constructor(globalObject, args, privateData) {
|
|
9
|
+
super(globalObject, args, privateData);
|
|
10
|
+
|
|
11
|
+
this._taskQueue = null;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
_dispatchToggleEvent() {
|
|
15
|
+
this._taskQueue = null;
|
|
16
|
+
|
|
17
|
+
fireAnEvent("toggle", this);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
_attrModified(name, value, oldValue) {
|
|
21
|
+
super._attrModified(name, value, oldValue);
|
|
22
|
+
|
|
23
|
+
if (name === "open" && this._taskQueue === null) {
|
|
24
|
+
// Check that the attribute is added or removed, not merely changed
|
|
25
|
+
if ((value !== oldValue && value !== null && oldValue === null) ||
|
|
26
|
+
(value === null && oldValue !== null)) {
|
|
27
|
+
this._taskQueue = setTimeout(this._dispatchToggleEvent.bind(this), 0);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
module.exports = {
|
|
34
|
+
implementation: HTMLDetailsElementImpl
|
|
35
|
+
};
|