happy-dom 17.1.7 → 17.1.9
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/cjs/PropertySymbol.cjs +2 -1
- package/cjs/PropertySymbol.cjs.map +1 -1
- package/cjs/PropertySymbol.d.ts +1 -0
- package/cjs/PropertySymbol.d.ts.map +1 -1
- package/cjs/event/EventTarget.cjs +64 -64
- package/cjs/event/EventTarget.cjs.map +1 -1
- package/cjs/event/EventTarget.d.ts.map +1 -1
- package/cjs/nodes/document/Document.cjs +693 -109
- package/cjs/nodes/document/Document.cjs.map +1 -1
- package/cjs/nodes/document/Document.d.ts +231 -109
- package/cjs/nodes/document/Document.d.ts.map +1 -1
- package/cjs/nodes/element/Element.cjs +47 -69
- package/cjs/nodes/element/Element.cjs.map +1 -1
- package/cjs/nodes/element/Element.d.ts +15 -40
- package/cjs/nodes/element/Element.d.ts.map +1 -1
- package/cjs/nodes/element/ElementEventAttributeUtility.cjs +94 -0
- package/cjs/nodes/element/ElementEventAttributeUtility.cjs.map +1 -0
- package/cjs/nodes/element/ElementEventAttributeUtility.d.ts +16 -0
- package/cjs/nodes/element/ElementEventAttributeUtility.d.ts.map +1 -0
- package/cjs/nodes/html-body-element/HTMLBodyElement.cjs +134 -18
- package/cjs/nodes/html-body-element/HTMLBodyElement.cjs.map +1 -1
- package/cjs/nodes/html-body-element/HTMLBodyElement.d.ts +36 -18
- package/cjs/nodes/html-body-element/HTMLBodyElement.d.ts.map +1 -1
- package/cjs/nodes/html-canvas-element/HTMLCanvasElement.cjs +33 -5
- package/cjs/nodes/html-canvas-element/HTMLCanvasElement.cjs.map +1 -1
- package/cjs/nodes/html-canvas-element/HTMLCanvasElement.d.ts +10 -5
- package/cjs/nodes/html-canvas-element/HTMLCanvasElement.d.ts.map +1 -1
- package/cjs/nodes/html-details-element/HTMLDetailsElement.cjs +9 -1
- package/cjs/nodes/html-details-element/HTMLDetailsElement.cjs.map +1 -1
- package/cjs/nodes/html-details-element/HTMLDetailsElement.d.ts +2 -1
- package/cjs/nodes/html-details-element/HTMLDetailsElement.d.ts.map +1 -1
- package/cjs/nodes/html-dialog-element/HTMLDialogElement.cjs +15 -2
- package/cjs/nodes/html-dialog-element/HTMLDialogElement.cjs.map +1 -1
- package/cjs/nodes/html-dialog-element/HTMLDialogElement.d.ts +4 -2
- package/cjs/nodes/html-dialog-element/HTMLDialogElement.d.ts.map +1 -1
- package/cjs/nodes/html-element/HTMLElement.cjs +328 -26
- package/cjs/nodes/html-element/HTMLElement.cjs.map +1 -1
- package/cjs/nodes/html-element/HTMLElement.d.ts +108 -25
- package/cjs/nodes/html-element/HTMLElement.d.ts.map +1 -1
- package/cjs/nodes/html-form-element/HTMLFormElement.cjs +22 -4
- package/cjs/nodes/html-form-element/HTMLFormElement.cjs.map +1 -1
- package/cjs/nodes/html-form-element/HTMLFormElement.d.ts +6 -3
- package/cjs/nodes/html-form-element/HTMLFormElement.d.ts.map +1 -1
- package/cjs/nodes/html-iframe-element/HTMLIFrameElement.cjs +16 -3
- package/cjs/nodes/html-iframe-element/HTMLIFrameElement.cjs.map +1 -1
- package/cjs/nodes/html-iframe-element/HTMLIFrameElement.d.ts +4 -2
- package/cjs/nodes/html-iframe-element/HTMLIFrameElement.d.ts.map +1 -1
- package/cjs/nodes/html-input-element/HTMLInputElement.cjs +22 -4
- package/cjs/nodes/html-input-element/HTMLInputElement.cjs.map +1 -1
- package/cjs/nodes/html-input-element/HTMLInputElement.d.ts +6 -3
- package/cjs/nodes/html-input-element/HTMLInputElement.d.ts.map +1 -1
- package/cjs/nodes/html-label-element/HTMLLabelElement.cjs +2 -1
- package/cjs/nodes/html-label-element/HTMLLabelElement.cjs.map +1 -1
- package/cjs/nodes/html-label-element/HTMLLabelElement.d.ts.map +1 -1
- package/cjs/nodes/html-link-element/HTMLLinkElement.cjs +16 -3
- package/cjs/nodes/html-link-element/HTMLLinkElement.cjs.map +1 -1
- package/cjs/nodes/html-link-element/HTMLLinkElement.d.ts +4 -3
- package/cjs/nodes/html-link-element/HTMLLinkElement.d.ts.map +1 -1
- package/cjs/nodes/html-media-element/HTMLMediaElement.cjs +142 -24
- package/cjs/nodes/html-media-element/HTMLMediaElement.cjs.map +1 -1
- package/cjs/nodes/html-media-element/HTMLMediaElement.d.ts +46 -23
- package/cjs/nodes/html-media-element/HTMLMediaElement.d.ts.map +1 -1
- package/cjs/nodes/html-script-element/HTMLScriptElement.cjs +16 -3
- package/cjs/nodes/html-script-element/HTMLScriptElement.cjs.map +1 -1
- package/cjs/nodes/html-script-element/HTMLScriptElement.d.ts +4 -3
- package/cjs/nodes/html-script-element/HTMLScriptElement.d.ts.map +1 -1
- package/cjs/nodes/html-select-element/HTMLSelectElement.cjs +16 -3
- package/cjs/nodes/html-select-element/HTMLSelectElement.cjs.map +1 -1
- package/cjs/nodes/html-select-element/HTMLSelectElement.d.ts +4 -2
- package/cjs/nodes/html-select-element/HTMLSelectElement.d.ts.map +1 -1
- package/cjs/nodes/html-slot-element/HTMLSlotElement.cjs +9 -1
- package/cjs/nodes/html-slot-element/HTMLSlotElement.cjs.map +1 -1
- package/cjs/nodes/html-slot-element/HTMLSlotElement.d.ts +2 -1
- package/cjs/nodes/html-slot-element/HTMLSlotElement.d.ts.map +1 -1
- package/cjs/nodes/html-text-area-element/HTMLTextAreaElement.cjs +16 -3
- package/cjs/nodes/html-text-area-element/HTMLTextAreaElement.cjs.map +1 -1
- package/cjs/nodes/html-text-area-element/HTMLTextAreaElement.d.ts +4 -2
- package/cjs/nodes/html-text-area-element/HTMLTextAreaElement.d.ts.map +1 -1
- package/cjs/nodes/html-track-element/HTMLTrackElement.cjs +9 -1
- package/cjs/nodes/html-track-element/HTMLTrackElement.cjs.map +1 -1
- package/cjs/nodes/html-track-element/HTMLTrackElement.d.ts +3 -1
- package/cjs/nodes/html-track-element/HTMLTrackElement.d.ts.map +1 -1
- package/cjs/nodes/shadow-root/ShadowRoot.cjs +10 -2
- package/cjs/nodes/shadow-root/ShadowRoot.cjs.map +1 -1
- package/cjs/nodes/shadow-root/ShadowRoot.d.ts +3 -1
- package/cjs/nodes/shadow-root/ShadowRoot.d.ts.map +1 -1
- package/cjs/nodes/svg-animation-element/SVGAnimationElement.cjs +21 -3
- package/cjs/nodes/svg-animation-element/SVGAnimationElement.cjs.map +1 -1
- package/cjs/nodes/svg-animation-element/SVGAnimationElement.d.ts +6 -3
- package/cjs/nodes/svg-animation-element/SVGAnimationElement.d.ts.map +1 -1
- package/cjs/nodes/svg-element/SVGElement.cjs +538 -7
- package/cjs/nodes/svg-element/SVGElement.cjs.map +1 -1
- package/cjs/nodes/svg-element/SVGElement.d.ts +178 -6
- package/cjs/nodes/svg-element/SVGElement.d.ts.map +1 -1
- package/cjs/nodes/svg-graphics-element/SVGGraphicsElement.cjs +21 -3
- package/cjs/nodes/svg-graphics-element/SVGGraphicsElement.cjs.map +1 -1
- package/cjs/nodes/svg-graphics-element/SVGGraphicsElement.d.ts +6 -3
- package/cjs/nodes/svg-graphics-element/SVGGraphicsElement.d.ts.map +1 -1
- package/cjs/nodes/svg-svg-element/SVGSVGElement.cjs +111 -18
- package/cjs/nodes/svg-svg-element/SVGSVGElement.cjs.map +1 -1
- package/cjs/nodes/svg-svg-element/SVGSVGElement.d.ts +36 -18
- package/cjs/nodes/svg-svg-element/SVGSVGElement.d.ts.map +1 -1
- package/lib/PropertySymbol.d.ts +1 -0
- package/lib/PropertySymbol.d.ts.map +1 -1
- package/lib/PropertySymbol.js +1 -0
- package/lib/PropertySymbol.js.map +1 -1
- package/lib/event/EventTarget.d.ts.map +1 -1
- package/lib/event/EventTarget.js +64 -64
- package/lib/event/EventTarget.js.map +1 -1
- package/lib/nodes/document/Document.d.ts +231 -109
- package/lib/nodes/document/Document.d.ts.map +1 -1
- package/lib/nodes/document/Document.js +693 -109
- package/lib/nodes/document/Document.js.map +1 -1
- package/lib/nodes/element/Element.d.ts +15 -40
- package/lib/nodes/element/Element.d.ts.map +1 -1
- package/lib/nodes/element/Element.js +47 -69
- package/lib/nodes/element/Element.js.map +1 -1
- package/lib/nodes/element/ElementEventAttributeUtility.d.ts +16 -0
- package/lib/nodes/element/ElementEventAttributeUtility.d.ts.map +1 -0
- package/lib/nodes/element/ElementEventAttributeUtility.js +65 -0
- package/lib/nodes/element/ElementEventAttributeUtility.js.map +1 -0
- package/lib/nodes/html-body-element/HTMLBodyElement.d.ts +36 -18
- package/lib/nodes/html-body-element/HTMLBodyElement.d.ts.map +1 -1
- package/lib/nodes/html-body-element/HTMLBodyElement.js +111 -18
- package/lib/nodes/html-body-element/HTMLBodyElement.js.map +1 -1
- package/lib/nodes/html-canvas-element/HTMLCanvasElement.d.ts +10 -5
- package/lib/nodes/html-canvas-element/HTMLCanvasElement.d.ts.map +1 -1
- package/lib/nodes/html-canvas-element/HTMLCanvasElement.js +33 -5
- package/lib/nodes/html-canvas-element/HTMLCanvasElement.js.map +1 -1
- package/lib/nodes/html-details-element/HTMLDetailsElement.d.ts +2 -1
- package/lib/nodes/html-details-element/HTMLDetailsElement.d.ts.map +1 -1
- package/lib/nodes/html-details-element/HTMLDetailsElement.js +9 -1
- package/lib/nodes/html-details-element/HTMLDetailsElement.js.map +1 -1
- package/lib/nodes/html-dialog-element/HTMLDialogElement.d.ts +4 -2
- package/lib/nodes/html-dialog-element/HTMLDialogElement.d.ts.map +1 -1
- package/lib/nodes/html-dialog-element/HTMLDialogElement.js +15 -2
- package/lib/nodes/html-dialog-element/HTMLDialogElement.js.map +1 -1
- package/lib/nodes/html-element/HTMLElement.d.ts +108 -25
- package/lib/nodes/html-element/HTMLElement.d.ts.map +1 -1
- package/lib/nodes/html-element/HTMLElement.js +328 -26
- package/lib/nodes/html-element/HTMLElement.js.map +1 -1
- package/lib/nodes/html-form-element/HTMLFormElement.d.ts +6 -3
- package/lib/nodes/html-form-element/HTMLFormElement.d.ts.map +1 -1
- package/lib/nodes/html-form-element/HTMLFormElement.js +22 -4
- package/lib/nodes/html-form-element/HTMLFormElement.js.map +1 -1
- package/lib/nodes/html-iframe-element/HTMLIFrameElement.d.ts +4 -2
- package/lib/nodes/html-iframe-element/HTMLIFrameElement.d.ts.map +1 -1
- package/lib/nodes/html-iframe-element/HTMLIFrameElement.js +16 -3
- package/lib/nodes/html-iframe-element/HTMLIFrameElement.js.map +1 -1
- package/lib/nodes/html-input-element/HTMLInputElement.d.ts +6 -3
- package/lib/nodes/html-input-element/HTMLInputElement.d.ts.map +1 -1
- package/lib/nodes/html-input-element/HTMLInputElement.js +22 -4
- package/lib/nodes/html-input-element/HTMLInputElement.js.map +1 -1
- package/lib/nodes/html-label-element/HTMLLabelElement.d.ts.map +1 -1
- package/lib/nodes/html-label-element/HTMLLabelElement.js +2 -1
- package/lib/nodes/html-label-element/HTMLLabelElement.js.map +1 -1
- package/lib/nodes/html-link-element/HTMLLinkElement.d.ts +4 -3
- package/lib/nodes/html-link-element/HTMLLinkElement.d.ts.map +1 -1
- package/lib/nodes/html-link-element/HTMLLinkElement.js +16 -3
- package/lib/nodes/html-link-element/HTMLLinkElement.js.map +1 -1
- package/lib/nodes/html-media-element/HTMLMediaElement.d.ts +46 -23
- package/lib/nodes/html-media-element/HTMLMediaElement.d.ts.map +1 -1
- package/lib/nodes/html-media-element/HTMLMediaElement.js +142 -24
- package/lib/nodes/html-media-element/HTMLMediaElement.js.map +1 -1
- package/lib/nodes/html-script-element/HTMLScriptElement.d.ts +4 -3
- package/lib/nodes/html-script-element/HTMLScriptElement.d.ts.map +1 -1
- package/lib/nodes/html-script-element/HTMLScriptElement.js +16 -3
- package/lib/nodes/html-script-element/HTMLScriptElement.js.map +1 -1
- package/lib/nodes/html-select-element/HTMLSelectElement.d.ts +4 -2
- package/lib/nodes/html-select-element/HTMLSelectElement.d.ts.map +1 -1
- package/lib/nodes/html-select-element/HTMLSelectElement.js +16 -3
- package/lib/nodes/html-select-element/HTMLSelectElement.js.map +1 -1
- package/lib/nodes/html-slot-element/HTMLSlotElement.d.ts +2 -1
- package/lib/nodes/html-slot-element/HTMLSlotElement.d.ts.map +1 -1
- package/lib/nodes/html-slot-element/HTMLSlotElement.js +9 -1
- package/lib/nodes/html-slot-element/HTMLSlotElement.js.map +1 -1
- package/lib/nodes/html-text-area-element/HTMLTextAreaElement.d.ts +4 -2
- package/lib/nodes/html-text-area-element/HTMLTextAreaElement.d.ts.map +1 -1
- package/lib/nodes/html-text-area-element/HTMLTextAreaElement.js +16 -3
- package/lib/nodes/html-text-area-element/HTMLTextAreaElement.js.map +1 -1
- package/lib/nodes/html-track-element/HTMLTrackElement.d.ts +3 -1
- package/lib/nodes/html-track-element/HTMLTrackElement.d.ts.map +1 -1
- package/lib/nodes/html-track-element/HTMLTrackElement.js +9 -1
- package/lib/nodes/html-track-element/HTMLTrackElement.js.map +1 -1
- package/lib/nodes/shadow-root/ShadowRoot.d.ts +3 -1
- package/lib/nodes/shadow-root/ShadowRoot.d.ts.map +1 -1
- package/lib/nodes/shadow-root/ShadowRoot.js +10 -2
- package/lib/nodes/shadow-root/ShadowRoot.js.map +1 -1
- package/lib/nodes/svg-animation-element/SVGAnimationElement.d.ts +6 -3
- package/lib/nodes/svg-animation-element/SVGAnimationElement.d.ts.map +1 -1
- package/lib/nodes/svg-animation-element/SVGAnimationElement.js +21 -3
- package/lib/nodes/svg-animation-element/SVGAnimationElement.js.map +1 -1
- package/lib/nodes/svg-element/SVGElement.d.ts +178 -6
- package/lib/nodes/svg-element/SVGElement.d.ts.map +1 -1
- package/lib/nodes/svg-element/SVGElement.js +538 -7
- package/lib/nodes/svg-element/SVGElement.js.map +1 -1
- package/lib/nodes/svg-graphics-element/SVGGraphicsElement.d.ts +6 -3
- package/lib/nodes/svg-graphics-element/SVGGraphicsElement.d.ts.map +1 -1
- package/lib/nodes/svg-graphics-element/SVGGraphicsElement.js +21 -3
- package/lib/nodes/svg-graphics-element/SVGGraphicsElement.js.map +1 -1
- package/lib/nodes/svg-svg-element/SVGSVGElement.d.ts +36 -18
- package/lib/nodes/svg-svg-element/SVGSVGElement.d.ts.map +1 -1
- package/lib/nodes/svg-svg-element/SVGSVGElement.js +111 -18
- package/lib/nodes/svg-svg-element/SVGSVGElement.js.map +1 -1
- package/package.json +1 -1
- package/src/PropertySymbol.ts +1 -0
- package/src/event/EventTarget.ts +69 -70
- package/src/nodes/document/Document.ts +927 -109
- package/src/nodes/element/Element.ts +67 -79
- package/src/nodes/element/ElementEventAttributeUtility.ts +89 -0
- package/src/nodes/html-body-element/HTMLBodyElement.ts +151 -18
- package/src/nodes/html-canvas-element/HTMLCanvasElement.ts +45 -5
- package/src/nodes/html-details-element/HTMLDetailsElement.ts +13 -1
- package/src/nodes/html-dialog-element/HTMLDialogElement.ts +21 -2
- package/src/nodes/html-element/HTMLElement.ts +439 -27
- package/src/nodes/html-form-element/HTMLFormElement.ts +30 -4
- package/src/nodes/html-iframe-element/HTMLIFrameElement.ts +23 -4
- package/src/nodes/html-input-element/HTMLInputElement.ts +31 -5
- package/src/nodes/html-label-element/HTMLLabelElement.ts +2 -1
- package/src/nodes/html-link-element/HTMLLinkElement.ts +23 -5
- package/src/nodes/html-media-element/HTMLMediaElement.ts +191 -25
- package/src/nodes/html-script-element/HTMLScriptElement.ts +23 -5
- package/src/nodes/html-select-element/HTMLSelectElement.ts +23 -4
- package/src/nodes/html-slot-element/HTMLSlotElement.ts +13 -1
- package/src/nodes/html-text-area-element/HTMLTextAreaElement.ts +23 -4
- package/src/nodes/html-track-element/HTMLTrackElement.ts +14 -1
- package/src/nodes/shadow-root/ShadowRoot.ts +15 -3
- package/src/nodes/svg-animation-element/SVGAnimationElement.ts +29 -3
- package/src/nodes/svg-element/SVGElement.ts +719 -8
- package/src/nodes/svg-graphics-element/SVGGraphicsElement.ts +29 -3
- package/src/nodes/svg-svg-element/SVGSVGElement.ts +149 -18
@@ -13,9 +13,6 @@ import DOMRectList from '../../dom/DOMRectList.js';
|
|
13
13
|
import Attr from '../attr/Attr.js';
|
14
14
|
import NamedNodeMap from './NamedNodeMap.js';
|
15
15
|
import Event from '../../event/Event.js';
|
16
|
-
import EventPhaseEnum from '../../event/EventPhaseEnum.js';
|
17
|
-
import WindowBrowserContext from '../../window/WindowBrowserContext.js';
|
18
|
-
import BrowserErrorCaptureEnum from '../../browser/enums/BrowserErrorCaptureEnum.js';
|
19
16
|
import NodeTypeEnum from '../node/NodeTypeEnum.js';
|
20
17
|
import IHTMLElementTagNameMap from '../../config/IHTMLElementTagNameMap.js';
|
21
18
|
import ISVGElementTagNameMap from '../../config/ISVGElementTagNameMap.js';
|
@@ -34,6 +31,7 @@ import HTMLParser from '../../html-parser/HTMLParser.js';
|
|
34
31
|
import IScrollToOptions from '../../window/IScrollToOptions.js';
|
35
32
|
import { AttributeUtility } from '../../utilities/AttributeUtility.js';
|
36
33
|
import DOMExceptionNameEnum from '../../exception/DOMExceptionNameEnum.js';
|
34
|
+
import ElementEventAttributeUtility from './ElementEventAttributeUtility.js';
|
37
35
|
|
38
36
|
type InsertAdjacentPosition = 'beforebegin' | 'afterbegin' | 'beforeend' | 'afterend';
|
39
37
|
|
@@ -49,42 +47,6 @@ export default class Element
|
|
49
47
|
public static [PropertySymbol.namespaceURI]: string | null = null;
|
50
48
|
public declare cloneNode: (deep?: boolean) => Element;
|
51
49
|
|
52
|
-
// Events
|
53
|
-
public oncancel: ((event: Event) => void) | null = null;
|
54
|
-
public onerror: ((event: Event) => void) | null = null;
|
55
|
-
public onscroll: ((event: Event) => void) | null = null;
|
56
|
-
public onselect: ((event: Event) => void) | null = null;
|
57
|
-
public onwheel: ((event: Event) => void) | null = null;
|
58
|
-
public oncopy: ((event: Event) => void) | null = null;
|
59
|
-
public oncut: ((event: Event) => void) | null = null;
|
60
|
-
public onpaste: ((event: Event) => void) | null = null;
|
61
|
-
public oncompositionend: ((event: Event) => void) | null = null;
|
62
|
-
public oncompositionstart: ((event: Event) => void) | null = null;
|
63
|
-
public oncompositionupdate: ((event: Event) => void) | null = null;
|
64
|
-
public onblur: ((event: Event) => void) | null = null;
|
65
|
-
public onfocus: ((event: Event) => void) | null = null;
|
66
|
-
public onfocusin: ((event: Event) => void) | null = null;
|
67
|
-
public onfocusout: ((event: Event) => void) | null = null;
|
68
|
-
public onfullscreenchange: ((event: Event) => void) | null = null;
|
69
|
-
public onfullscreenerror: ((event: Event) => void) | null = null;
|
70
|
-
public onkeydown: ((event: Event) => void) | null = null;
|
71
|
-
public onkeyup: ((event: Event) => void) | null = null;
|
72
|
-
public onauxclick: ((event: Event) => void) | null = null;
|
73
|
-
public onclick: ((event: Event) => void) | null = null;
|
74
|
-
public oncontextmenu: ((event: Event) => void) | null = null;
|
75
|
-
public ondblclick: ((event: Event) => void) | null = null;
|
76
|
-
public onmousedown: ((event: Event) => void) | null = null;
|
77
|
-
public onmouseenter: ((event: Event) => void) | null = null;
|
78
|
-
public onmouseleave: ((event: Event) => void) | null = null;
|
79
|
-
public onmousemove: ((event: Event) => void) | null = null;
|
80
|
-
public onmouseout: ((event: Event) => void) | null = null;
|
81
|
-
public onmouseover: ((event: Event) => void) | null = null;
|
82
|
-
public onmouseup: ((event: Event) => void) | null = null;
|
83
|
-
public ontouchcancel: ((event: Event) => void) | null = null;
|
84
|
-
public ontouchend: ((event: Event) => void) | null = null;
|
85
|
-
public ontouchmove: ((event: Event) => void) | null = null;
|
86
|
-
public ontouchstart: ((event: Event) => void) | null = null;
|
87
|
-
|
88
50
|
// Internal properties
|
89
51
|
public [PropertySymbol.classList]: DOMTokenList | null = null;
|
90
52
|
public [PropertySymbol.isValue]: string | null = null;
|
@@ -99,6 +61,7 @@ export default class Element
|
|
99
61
|
public [PropertySymbol.attributesProxy]: NamedNodeMap | null = null;
|
100
62
|
public [PropertySymbol.children]: HTMLCollection<Element> | null = null;
|
101
63
|
public [PropertySymbol.computedStyle]: CSSStyleDeclaration | null = null;
|
64
|
+
public [PropertySymbol.propertyEventListeners]: Map<string, (event: Event) => void> = new Map();
|
102
65
|
public declare [PropertySymbol.tagName]: string | null;
|
103
66
|
public declare [PropertySymbol.localName]: string | null;
|
104
67
|
public declare [PropertySymbol.namespaceURI]: string | null;
|
@@ -125,6 +88,60 @@ export default class Element
|
|
125
88
|
}
|
126
89
|
}
|
127
90
|
|
91
|
+
// Events
|
92
|
+
|
93
|
+
/* eslint-disable jsdoc/require-jsdoc */
|
94
|
+
|
95
|
+
public get onfullscreenerror(): ((event: Event) => void) | null {
|
96
|
+
return ElementEventAttributeUtility.getEventListener(this, 'onfullscreenerror');
|
97
|
+
}
|
98
|
+
|
99
|
+
public set onfullscreenerror(value: ((event: Event) => void) | null) {
|
100
|
+
this[PropertySymbol.propertyEventListeners].set('onfullscreenerror', value);
|
101
|
+
}
|
102
|
+
|
103
|
+
public get onfullscreenchange(): ((event: Event) => void) | null {
|
104
|
+
return ElementEventAttributeUtility.getEventListener(this, 'onfullscreenchange');
|
105
|
+
}
|
106
|
+
|
107
|
+
public set onfullscreenchange(value: ((event: Event) => void) | null) {
|
108
|
+
this[PropertySymbol.propertyEventListeners].set('onfullscreenchange', value);
|
109
|
+
}
|
110
|
+
|
111
|
+
public get onbeforecopy(): ((event: Event) => void) | null {
|
112
|
+
return ElementEventAttributeUtility.getEventListener(this, 'onbeforecopy');
|
113
|
+
}
|
114
|
+
|
115
|
+
public set onbeforecopy(value: ((event: Event) => void) | null) {
|
116
|
+
this[PropertySymbol.propertyEventListeners].set('onbeforecopy', value);
|
117
|
+
}
|
118
|
+
|
119
|
+
public get onbeforecut(): ((event: Event) => void) | null {
|
120
|
+
return ElementEventAttributeUtility.getEventListener(this, 'onbeforecut');
|
121
|
+
}
|
122
|
+
|
123
|
+
public set onbeforecut(value: ((event: Event) => void) | null) {
|
124
|
+
this[PropertySymbol.propertyEventListeners].set('onbeforecut', value);
|
125
|
+
}
|
126
|
+
|
127
|
+
public get onbeforepaste(): ((event: Event) => void) | null {
|
128
|
+
return ElementEventAttributeUtility.getEventListener(this, 'onbeforepaste');
|
129
|
+
}
|
130
|
+
|
131
|
+
public set onbeforepaste(value: ((event: Event) => void) | null) {
|
132
|
+
this[PropertySymbol.propertyEventListeners].set('onbeforepaste', value);
|
133
|
+
}
|
134
|
+
|
135
|
+
public get onsearch(): ((event: Event) => void) | null {
|
136
|
+
return ElementEventAttributeUtility.getEventListener(this, 'onsearch');
|
137
|
+
}
|
138
|
+
|
139
|
+
public set onsearch(value: ((event: Event) => void) | null) {
|
140
|
+
this[PropertySymbol.propertyEventListeners].set('onsearch', value);
|
141
|
+
}
|
142
|
+
|
143
|
+
/* eslint-enable jsdoc/require-jsdoc */
|
144
|
+
|
128
145
|
/**
|
129
146
|
* Returns tag name.
|
130
147
|
*
|
@@ -998,7 +1015,7 @@ export default class Element
|
|
998
1015
|
): NodeList<IHTMLElementTagNameMap[K]>;
|
999
1016
|
|
1000
1017
|
/**
|
1001
|
-
* Query CSS selector to find matching
|
1018
|
+
* Query CSS selector to find matching elements.
|
1002
1019
|
*
|
1003
1020
|
* @param selector CSS selector.
|
1004
1021
|
* @returns Matching elements.
|
@@ -1008,7 +1025,7 @@ export default class Element
|
|
1008
1025
|
): NodeList<ISVGElementTagNameMap[K]>;
|
1009
1026
|
|
1010
1027
|
/**
|
1011
|
-
* Query CSS selector to find matching
|
1028
|
+
* Query CSS selector to find matching elements.
|
1012
1029
|
*
|
1013
1030
|
* @param selector CSS selector.
|
1014
1031
|
* @returns Matching elements.
|
@@ -1016,7 +1033,7 @@ export default class Element
|
|
1016
1033
|
public querySelectorAll(selector: string): NodeList<Element>;
|
1017
1034
|
|
1018
1035
|
/**
|
1019
|
-
* Query CSS selector to find matching
|
1036
|
+
* Query CSS selector to find matching elements.
|
1020
1037
|
*
|
1021
1038
|
* @param selector CSS selector.
|
1022
1039
|
* @returns Matching elements.
|
@@ -1302,43 +1319,6 @@ export default class Element
|
|
1302
1319
|
// Do nothing
|
1303
1320
|
}
|
1304
1321
|
|
1305
|
-
/**
|
1306
|
-
* @override
|
1307
|
-
*/
|
1308
|
-
public override dispatchEvent(event: Event): boolean {
|
1309
|
-
const returnValue = super.dispatchEvent(event);
|
1310
|
-
const window = this[PropertySymbol.window];
|
1311
|
-
const browserSettings = new WindowBrowserContext(window).getSettings();
|
1312
|
-
|
1313
|
-
if (
|
1314
|
-
browserSettings &&
|
1315
|
-
!browserSettings.disableJavaScriptEvaluation &&
|
1316
|
-
event.eventPhase === EventPhaseEnum.none &&
|
1317
|
-
!event[PropertySymbol.immediatePropagationStopped]
|
1318
|
-
) {
|
1319
|
-
const attribute = this.getAttribute('on' + event.type);
|
1320
|
-
|
1321
|
-
if (attribute && !event[PropertySymbol.immediatePropagationStopped]) {
|
1322
|
-
const code = `//# sourceURL=${window.location.href}\n${attribute}`;
|
1323
|
-
|
1324
|
-
if (
|
1325
|
-
browserSettings.disableErrorCapturing ||
|
1326
|
-
browserSettings.errorCapture !== BrowserErrorCaptureEnum.tryAndCatch
|
1327
|
-
) {
|
1328
|
-
window.eval(code);
|
1329
|
-
} else {
|
1330
|
-
try {
|
1331
|
-
window.eval(code);
|
1332
|
-
} catch (error) {
|
1333
|
-
window[PropertySymbol.dispatchError](error);
|
1334
|
-
}
|
1335
|
-
}
|
1336
|
-
}
|
1337
|
-
}
|
1338
|
-
|
1339
|
-
return returnValue;
|
1340
|
-
}
|
1341
|
-
|
1342
1322
|
/**
|
1343
1323
|
* @override
|
1344
1324
|
*/
|
@@ -1418,6 +1398,14 @@ export default class Element
|
|
1418
1398
|
}
|
1419
1399
|
}
|
1420
1400
|
|
1401
|
+
if (
|
1402
|
+
this[attribute[PropertySymbol.name]] !== undefined &&
|
1403
|
+
attribute[PropertySymbol.name][0] === 'o' &&
|
1404
|
+
attribute[PropertySymbol.name][1] === 'n'
|
1405
|
+
) {
|
1406
|
+
this[PropertySymbol.propertyEventListeners].delete(attribute[PropertySymbol.name]);
|
1407
|
+
}
|
1408
|
+
|
1421
1409
|
if (attribute[PropertySymbol.name] === 'id' && this[PropertySymbol.isConnected]) {
|
1422
1410
|
if (replacedAttribute?.[PropertySymbol.value]) {
|
1423
1411
|
this.#removeIdentifierFromWindow(replacedAttribute[PropertySymbol.value]);
|
@@ -0,0 +1,89 @@
|
|
1
|
+
import BrowserErrorCaptureEnum from '../../browser/enums/BrowserErrorCaptureEnum.js';
|
2
|
+
import WindowBrowserContext from '../../window/WindowBrowserContext.js';
|
3
|
+
import * as PropertySymbol from '../../PropertySymbol.js';
|
4
|
+
import Event from '../../event/Event.js';
|
5
|
+
import Element from './Element.js';
|
6
|
+
|
7
|
+
/**
|
8
|
+
* ECMAScript module compiler.
|
9
|
+
*/
|
10
|
+
export default class ElementEventAttributeUtility {
|
11
|
+
/**
|
12
|
+
* Evaluates code in attribute and returns event listener.
|
13
|
+
*
|
14
|
+
* @param element
|
15
|
+
* @param property Property.
|
16
|
+
* @returns Result.
|
17
|
+
*/
|
18
|
+
public static getEventListener(
|
19
|
+
element: Element,
|
20
|
+
property: string
|
21
|
+
): ((event: Event) => void) | null {
|
22
|
+
const cached = element[PropertySymbol.propertyEventListeners].get(property);
|
23
|
+
if (cached) {
|
24
|
+
return cached;
|
25
|
+
}
|
26
|
+
|
27
|
+
const window = element[PropertySymbol.ownerDocument][PropertySymbol.defaultView];
|
28
|
+
const browserSettings = new WindowBrowserContext(window).getSettings();
|
29
|
+
|
30
|
+
if (!browserSettings) {
|
31
|
+
return null;
|
32
|
+
}
|
33
|
+
|
34
|
+
const code = element.getAttribute(property);
|
35
|
+
|
36
|
+
if (!code) {
|
37
|
+
return null;
|
38
|
+
}
|
39
|
+
|
40
|
+
let newCode = `(function anonymous($happy_dom, event) {\n//# sourceURL=${window.location.href}\n`;
|
41
|
+
|
42
|
+
if (
|
43
|
+
browserSettings &&
|
44
|
+
!browserSettings.disableErrorCapturing &&
|
45
|
+
browserSettings.errorCapture === BrowserErrorCaptureEnum.tryAndCatch
|
46
|
+
) {
|
47
|
+
newCode += 'try {\n';
|
48
|
+
}
|
49
|
+
|
50
|
+
newCode += code;
|
51
|
+
|
52
|
+
if (
|
53
|
+
browserSettings &&
|
54
|
+
!browserSettings.disableErrorCapturing &&
|
55
|
+
browserSettings.errorCapture === BrowserErrorCaptureEnum.tryAndCatch
|
56
|
+
) {
|
57
|
+
newCode += '\n} catch(e) { $happy_dom.dispatchError(e); }\n';
|
58
|
+
}
|
59
|
+
|
60
|
+
newCode += '})';
|
61
|
+
|
62
|
+
let listener: ((event: Event) => void) | null = null;
|
63
|
+
|
64
|
+
try {
|
65
|
+
listener = window.eval(newCode).bind(element, {
|
66
|
+
dispatchError: window[PropertySymbol.dispatchError]
|
67
|
+
});
|
68
|
+
} catch (e) {
|
69
|
+
const error = new window.SyntaxError(
|
70
|
+
`Failed to read the '${property}' property from '${element.constructor.name}': ${e.message}`
|
71
|
+
);
|
72
|
+
if (
|
73
|
+
browserSettings.disableErrorCapturing ||
|
74
|
+
browserSettings.errorCapture !== BrowserErrorCaptureEnum.tryAndCatch
|
75
|
+
) {
|
76
|
+
throw error;
|
77
|
+
} else {
|
78
|
+
window[PropertySymbol.dispatchError](error);
|
79
|
+
return null;
|
80
|
+
}
|
81
|
+
}
|
82
|
+
|
83
|
+
if (listener) {
|
84
|
+
element[PropertySymbol.propertyEventListeners].set(property, listener);
|
85
|
+
}
|
86
|
+
|
87
|
+
return listener;
|
88
|
+
}
|
89
|
+
}
|
@@ -1,5 +1,8 @@
|
|
1
1
|
import Event from '../../event/Event.js';
|
2
|
+
import ElementEventAttributeUtility from '../element/ElementEventAttributeUtility.js';
|
2
3
|
import HTMLElement from '../html-element/HTMLElement.js';
|
4
|
+
import * as PropertySymbol from '../../PropertySymbol.js';
|
5
|
+
|
3
6
|
/**
|
4
7
|
* HTMLBodyElement
|
5
8
|
*
|
@@ -7,22 +10,152 @@ import HTMLElement from '../html-element/HTMLElement.js';
|
|
7
10
|
*/
|
8
11
|
export default class HTMLBodyElement extends HTMLElement {
|
9
12
|
// Events
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
public
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
public
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
public
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
public
|
26
|
-
|
27
|
-
|
13
|
+
|
14
|
+
/* eslint-disable jsdoc/require-jsdoc */
|
15
|
+
|
16
|
+
public get onafterprint(): ((event: Event) => void) | null {
|
17
|
+
return ElementEventAttributeUtility.getEventListener(this, 'onafterprint');
|
18
|
+
}
|
19
|
+
|
20
|
+
public set onafterprint(value: ((event: Event) => void) | null) {
|
21
|
+
this[PropertySymbol.propertyEventListeners].set('onafterprint', value);
|
22
|
+
}
|
23
|
+
|
24
|
+
public get onbeforeprint(): ((event: Event) => void) | null {
|
25
|
+
return ElementEventAttributeUtility.getEventListener(this, 'onbeforeprint');
|
26
|
+
}
|
27
|
+
|
28
|
+
public set onbeforeprint(value: ((event: Event) => void) | null) {
|
29
|
+
this[PropertySymbol.propertyEventListeners].set('onbeforeprint', value);
|
30
|
+
}
|
31
|
+
|
32
|
+
public get onbeforeunload(): ((event: Event) => void) | null {
|
33
|
+
return ElementEventAttributeUtility.getEventListener(this, 'onbeforeunload');
|
34
|
+
}
|
35
|
+
|
36
|
+
public set onbeforeunload(value: ((event: Event) => void) | null) {
|
37
|
+
this[PropertySymbol.propertyEventListeners].set('onbeforeunload', value);
|
38
|
+
}
|
39
|
+
|
40
|
+
public get ongamepadconnected(): ((event: Event) => void) | null {
|
41
|
+
return ElementEventAttributeUtility.getEventListener(this, 'ongamepadconnected');
|
42
|
+
}
|
43
|
+
|
44
|
+
public set ongamepadconnected(value: ((event: Event) => void) | null) {
|
45
|
+
this[PropertySymbol.propertyEventListeners].set('ongamepadconnected', value);
|
46
|
+
}
|
47
|
+
|
48
|
+
public get ongamepaddisconnected(): ((event: Event) => void) | null {
|
49
|
+
return ElementEventAttributeUtility.getEventListener(this, 'ongamepaddisconnected');
|
50
|
+
}
|
51
|
+
|
52
|
+
public set ongamepaddisconnected(value: ((event: Event) => void) | null) {
|
53
|
+
this[PropertySymbol.propertyEventListeners].set('ongamepaddisconnected', value);
|
54
|
+
}
|
55
|
+
|
56
|
+
public get onhashchange(): ((event: Event) => void) | null {
|
57
|
+
return ElementEventAttributeUtility.getEventListener(this, 'onhashchange');
|
58
|
+
}
|
59
|
+
|
60
|
+
public set onhashchange(value: ((event: Event) => void) | null) {
|
61
|
+
this[PropertySymbol.propertyEventListeners].set('onhashchange', value);
|
62
|
+
}
|
63
|
+
|
64
|
+
public get onlanguagechange(): ((event: Event) => void) | null {
|
65
|
+
return ElementEventAttributeUtility.getEventListener(this, 'onlanguagechange');
|
66
|
+
}
|
67
|
+
|
68
|
+
public set onlanguagechange(value: ((event: Event) => void) | null) {
|
69
|
+
this[PropertySymbol.propertyEventListeners].set('onlanguagechange', value);
|
70
|
+
}
|
71
|
+
|
72
|
+
public get onmessage(): ((event: Event) => void) | null {
|
73
|
+
return ElementEventAttributeUtility.getEventListener(this, 'onmessage');
|
74
|
+
}
|
75
|
+
|
76
|
+
public set onmessage(value: ((event: Event) => void) | null) {
|
77
|
+
this[PropertySymbol.propertyEventListeners].set('onmessage', value);
|
78
|
+
}
|
79
|
+
|
80
|
+
public get onmessageerror(): ((event: Event) => void) | null {
|
81
|
+
return ElementEventAttributeUtility.getEventListener(this, 'onmessageerror');
|
82
|
+
}
|
83
|
+
|
84
|
+
public set onmessageerror(value: ((event: Event) => void) | null) {
|
85
|
+
this[PropertySymbol.propertyEventListeners].set('onmessageerror', value);
|
86
|
+
}
|
87
|
+
|
88
|
+
public get onoffline(): ((event: Event) => void) | null {
|
89
|
+
return ElementEventAttributeUtility.getEventListener(this, 'onoffline');
|
90
|
+
}
|
91
|
+
|
92
|
+
public set onoffline(value: ((event: Event) => void) | null) {
|
93
|
+
this[PropertySymbol.propertyEventListeners].set('onoffline', value);
|
94
|
+
}
|
95
|
+
|
96
|
+
public get ononline(): ((event: Event) => void) | null {
|
97
|
+
return ElementEventAttributeUtility.getEventListener(this, 'ononline');
|
98
|
+
}
|
99
|
+
|
100
|
+
public set ononline(value: ((event: Event) => void) | null) {
|
101
|
+
this[PropertySymbol.propertyEventListeners].set('ononline', value);
|
102
|
+
}
|
103
|
+
|
104
|
+
public get onpagehide(): ((event: Event) => void) | null {
|
105
|
+
return ElementEventAttributeUtility.getEventListener(this, 'onpagehide');
|
106
|
+
}
|
107
|
+
|
108
|
+
public set onpagehide(value: ((event: Event) => void) | null) {
|
109
|
+
this[PropertySymbol.propertyEventListeners].set('onpagehide', value);
|
110
|
+
}
|
111
|
+
|
112
|
+
public get onpageshow(): ((event: Event) => void) | null {
|
113
|
+
return ElementEventAttributeUtility.getEventListener(this, 'onpageshow');
|
114
|
+
}
|
115
|
+
|
116
|
+
public set onpageshow(value: ((event: Event) => void) | null) {
|
117
|
+
this[PropertySymbol.propertyEventListeners].set('onpageshow', value);
|
118
|
+
}
|
119
|
+
|
120
|
+
public get onpopstate(): ((event: Event) => void) | null {
|
121
|
+
return ElementEventAttributeUtility.getEventListener(this, 'onpopstate');
|
122
|
+
}
|
123
|
+
|
124
|
+
public set onpopstate(value: ((event: Event) => void) | null) {
|
125
|
+
this[PropertySymbol.propertyEventListeners].set('onpopstate', value);
|
126
|
+
}
|
127
|
+
|
128
|
+
public get onrejectionhandled(): ((event: Event) => void) | null {
|
129
|
+
return ElementEventAttributeUtility.getEventListener(this, 'onrejectionhandled');
|
130
|
+
}
|
131
|
+
|
132
|
+
public set onrejectionhandled(value: ((event: Event) => void) | null) {
|
133
|
+
this[PropertySymbol.propertyEventListeners].set('onrejectionhandled', value);
|
134
|
+
}
|
135
|
+
|
136
|
+
public get onstorage(): ((event: Event) => void) | null {
|
137
|
+
return ElementEventAttributeUtility.getEventListener(this, 'onstorage');
|
138
|
+
}
|
139
|
+
|
140
|
+
public set onstorage(value: ((event: Event) => void) | null) {
|
141
|
+
this[PropertySymbol.propertyEventListeners].set('onstorage', value);
|
142
|
+
}
|
143
|
+
|
144
|
+
public get onunhandledrejection(): ((event: Event) => void) | null {
|
145
|
+
return ElementEventAttributeUtility.getEventListener(this, 'onunhandledrejection');
|
146
|
+
}
|
147
|
+
|
148
|
+
public set onunhandledrejection(value: ((event: Event) => void) | null) {
|
149
|
+
this[PropertySymbol.propertyEventListeners].set('onunhandledrejection', value);
|
150
|
+
}
|
151
|
+
|
152
|
+
public get onunload(): ((event: Event) => void) | null {
|
153
|
+
return ElementEventAttributeUtility.getEventListener(this, 'onunload');
|
154
|
+
}
|
155
|
+
|
156
|
+
public set onunload(value: ((event: Event) => void) | null) {
|
157
|
+
this[PropertySymbol.propertyEventListeners].set('onunload', value);
|
158
|
+
}
|
159
|
+
|
160
|
+
/* eslint-enable jsdoc/require-jsdoc */
|
28
161
|
}
|
@@ -4,6 +4,7 @@ import Blob from '../../file/Blob.js';
|
|
4
4
|
import OffscreenCanvas from './OffscreenCanvas.js';
|
5
5
|
import Event from '../../event/Event.js';
|
6
6
|
import MediaStream from '../html-media-element/MediaStream.js';
|
7
|
+
import ElementEventAttributeUtility from '../element/ElementEventAttributeUtility.js';
|
7
8
|
|
8
9
|
const DEVICE_ID = 'S3F/aBCdEfGHIjKlMnOpQRStUvWxYz1234567890+1AbC2DEf2GHi3jK34le+ab12C3+1aBCdEf==';
|
9
10
|
|
@@ -14,11 +15,50 @@ const DEVICE_ID = 'S3F/aBCdEfGHIjKlMnOpQRStUvWxYz1234567890+1AbC2DEf2GHi3jK34le+
|
|
14
15
|
*/
|
15
16
|
export default class HTMLCanvasElement extends HTMLElement {
|
16
17
|
// Events
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
public
|
21
|
-
|
18
|
+
|
19
|
+
/* eslint-disable jsdoc/require-jsdoc */
|
20
|
+
|
21
|
+
public get oncontextlost(): ((event: Event) => void) | null {
|
22
|
+
return ElementEventAttributeUtility.getEventListener(this, 'oncontextlost');
|
23
|
+
}
|
24
|
+
|
25
|
+
public set oncontextlost(value: ((event: Event) => void) | null) {
|
26
|
+
this[PropertySymbol.propertyEventListeners].set('oncontextlost', value);
|
27
|
+
}
|
28
|
+
|
29
|
+
public get oncontextrestored(): ((event: Event) => void) | null {
|
30
|
+
return ElementEventAttributeUtility.getEventListener(this, 'oncontextrestored');
|
31
|
+
}
|
32
|
+
|
33
|
+
public set oncontextrestored(value: ((event: Event) => void) | null) {
|
34
|
+
this[PropertySymbol.propertyEventListeners].set('oncontextrestored', value);
|
35
|
+
}
|
36
|
+
|
37
|
+
public get onwebglcontextcreationerror(): ((event: Event) => void) | null {
|
38
|
+
return ElementEventAttributeUtility.getEventListener(this, 'onwebglcontextcreationerror');
|
39
|
+
}
|
40
|
+
|
41
|
+
public set onwebglcontextcreationerror(value: ((event: Event) => void) | null) {
|
42
|
+
this[PropertySymbol.propertyEventListeners].set('onwebglcontextcreationerror', value);
|
43
|
+
}
|
44
|
+
|
45
|
+
public get onwebglcontextlost(): ((event: Event) => void) | null {
|
46
|
+
return ElementEventAttributeUtility.getEventListener(this, 'onwebglcontextlost');
|
47
|
+
}
|
48
|
+
|
49
|
+
public set onwebglcontextlost(value: ((event: Event) => void) | null) {
|
50
|
+
this[PropertySymbol.propertyEventListeners].set('onwebglcontextlost', value);
|
51
|
+
}
|
52
|
+
|
53
|
+
public get onwebglcontextrestored(): ((event: Event) => void) | null {
|
54
|
+
return ElementEventAttributeUtility.getEventListener(this, 'onwebglcontextrestored');
|
55
|
+
}
|
56
|
+
|
57
|
+
public set onwebglcontextrestored(value: ((event: Event) => void) | null) {
|
58
|
+
this[PropertySymbol.propertyEventListeners].set('onwebglcontextrestored', value);
|
59
|
+
}
|
60
|
+
|
61
|
+
/* eslint-enable jsdoc/require-jsdoc */
|
22
62
|
|
23
63
|
/**
|
24
64
|
* Returns width.
|
@@ -4,6 +4,7 @@ import * as PropertySymbol from '../../PropertySymbol.js';
|
|
4
4
|
import Attr from '../attr/Attr.js';
|
5
5
|
import EventPhaseEnum from '../../event/EventPhaseEnum.js';
|
6
6
|
import MouseEvent from '../../event/events/MouseEvent.js';
|
7
|
+
import ElementEventAttributeUtility from '../element/ElementEventAttributeUtility.js';
|
7
8
|
|
8
9
|
/**
|
9
10
|
* HTMLDetailsElement
|
@@ -12,7 +13,18 @@ import MouseEvent from '../../event/events/MouseEvent.js';
|
|
12
13
|
*/
|
13
14
|
export default class HTMLDetailsElement extends HTMLElement {
|
14
15
|
// Events
|
15
|
-
|
16
|
+
|
17
|
+
/* eslint-disable jsdoc/require-jsdoc */
|
18
|
+
|
19
|
+
public get ontoggle(): ((event: Event) => void) | null {
|
20
|
+
return ElementEventAttributeUtility.getEventListener(this, 'ontoggle');
|
21
|
+
}
|
22
|
+
|
23
|
+
public set ontoggle(value: ((event: Event) => void) | null) {
|
24
|
+
this[PropertySymbol.propertyEventListeners].set('ontoggle', value);
|
25
|
+
}
|
26
|
+
|
27
|
+
/* eslint-enable jsdoc/require-jsdoc */
|
16
28
|
|
17
29
|
/**
|
18
30
|
* Returns the open attribute.
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import Event from '../../event/Event.js';
|
2
2
|
import HTMLElement from '../html-element/HTMLElement.js';
|
3
3
|
import * as PropertySymbol from '../../PropertySymbol.js';
|
4
|
+
import ElementEventAttributeUtility from '../element/ElementEventAttributeUtility.js';
|
4
5
|
|
5
6
|
/**
|
6
7
|
* HTML Dialog Element.
|
@@ -12,8 +13,26 @@ export default class HTMLDialogElement extends HTMLElement {
|
|
12
13
|
public [PropertySymbol.returnValue] = '';
|
13
14
|
|
14
15
|
// Events
|
15
|
-
|
16
|
-
|
16
|
+
|
17
|
+
/* eslint-disable jsdoc/require-jsdoc */
|
18
|
+
|
19
|
+
public get oncancel(): ((event: Event) => void) | null {
|
20
|
+
return ElementEventAttributeUtility.getEventListener(this, 'oncancel');
|
21
|
+
}
|
22
|
+
|
23
|
+
public set oncancel(value: ((event: Event) => void) | null) {
|
24
|
+
this[PropertySymbol.propertyEventListeners].set('oncancel', value);
|
25
|
+
}
|
26
|
+
|
27
|
+
public get onclose(): ((event: Event) => void) | null {
|
28
|
+
return ElementEventAttributeUtility.getEventListener(this, 'onclose');
|
29
|
+
}
|
30
|
+
|
31
|
+
public set onclose(value: ((event: Event) => void) | null) {
|
32
|
+
this[PropertySymbol.propertyEventListeners].set('onclose', value);
|
33
|
+
}
|
34
|
+
|
35
|
+
/* eslint-enable jsdoc/require-jsdoc */
|
17
36
|
|
18
37
|
/**
|
19
38
|
* Returns return value.
|